(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki.ml,v 1.14 2004/10/04 15:19:56 rich Exp $
+ * $Id: cocanwiki.ml,v 1.17 2004/10/11 14:13:04 rich Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* register_script ~restrict:[CanEdit ; CanManageUsers] run
*)
type permissions_t = CanView | CanEdit | CanManageUsers | CanManageContacts
- | CanManageSite | CanEditGlobalCSS
+ | CanManageSite | CanEditGlobalCSS | CanImportMail
(* The "user object". *)
type user_t = Anonymous (* Not logged in. *)
let can_manage_contacts host = test_permission host CanManageContacts
let can_manage_site host = test_permission host CanManageSite
let can_edit_global_css host = test_permission host CanEditGlobalCSS
+let can_import_mail host = test_permission host CanImportMail
(* Our wrapper around the standard [register_script] function.
*
dbh#prepare_cached
"select u.id, u.name, u.can_edit, u.can_manage_users,
u.can_manage_contacts, u.can_manage_site,
- u.can_edit_global_css
+ u.can_edit_global_css, u.can_import_mail
from usercookies uc, users u
where uc.cookie = ? and uc.userid = u.id and u.hostid = ?" in
sth#execute [`String cookie; `Int hostid];
[ `Int userid; `String name;
`Bool can_edit; `Bool can_manage_users;
`Bool can_manage_contacts; `Bool can_manage_site;
- `Bool can_edit_global_css ] ->
+ `Bool can_edit_global_css; `Bool can_import_mail ] ->
(* Every logged in user can view. *)
let perms = [CanView] in
let perms =
let perms =
if can_edit_global_css then CanEditGlobalCSS :: perms
else perms in
+ let perms =
+ if can_import_mail then CanImportMail :: perms
+ else perms in
User (userid, name, perms)
| _ -> assert false)
with
if not (isalnum str.[i]) then str.[i] <- '_'
done;
str
+
+(* List of extensions currently registered. *)
+type extension_t = Dbi.connection -> int -> string -> string
+let extensions = ref ([] : (string * extension_t) list)
+
+(* Maximum degree of redirection. *)
+let max_redirect = 4