X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fcocanwiki.ml;h=7114c2cf94b09482d0595eddea347df1a9613466;hb=6eacefcb7258db7b56fe796af84961cafac90eac;hp=56645826b4247d906f4bf84adc2c1cc31ada00b9;hpb=ae40d142ea634f9bd4e64f4f5d333021eefaf05b;p=cocanwiki.git diff --git a/scripts/cocanwiki.ml b/scripts/cocanwiki.ml index 5664582..7114c2c 100644 --- a/scripts/cocanwiki.ml +++ b/scripts/cocanwiki.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: cocanwiki.ml,v 1.15 2004/10/07 16:54:24 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 @@ -46,7 +46,7 @@ type host_t = { hostname : string; * 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. *) @@ -65,6 +65,7 @@ let can_manage_users host = test_permission host CanManageUsers 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. * @@ -150,7 +151,7 @@ let register_script ?(restrict = []) ?(anonymous = true) run = 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]; @@ -158,7 +159,7 @@ let register_script ?(restrict = []) ?(anonymous = true) run = [ `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 = @@ -176,6 +177,9 @@ let register_script ?(restrict = []) ?(anonymous = true) run = 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 @@ -222,3 +226,6 @@ let linkname_of_sectionname 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