]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/PagePermissions
Improve example taken from previous page
[SourceForge/phpwiki.git] / pgsrc / PagePermissions
1 Date: Fri, 15 Oct 2004 19:08:04 -0700
2 Mime-Version: 1.0 (Produced by PhpWiki 1.3.10)
3 X-Rcs-Id: $Id: PagePermissions,v 1.1 2004-11-03 16:43:56 rurban Exp $
4 Content-Type: application/x-phpwiki;
5   pagename=PagePermissions;
6   pgsrc_version="2 $Revision: 1.1 $";
7   flags="";
8   markup=2;
9   charset=iso-8859-1
10 Content-Transfer-Encoding: binary
11
12 !!! Full recursive ACL page permissions supported (Solaris / Windows style)
13
14 Boolean permissions per page and action (*granted* or *denied*) based on the current users
15 group membership is implemented with ACL's (Access Control Lists).
16 Opposed to the simplier unix like ugo:rwx system. <br>
17 The previous system was only based on action and current user, independent of pages.
18
19 A individual page permission may be inherited from its parent pages, and
20 from an optional master page ("." or _dotpage'). <br>
21 Use predefined default permissions, if a "." page does not exist. <br>
22 Pagenames starting with "." have tighter default permissions. (edit, change, list disallowed)
23
24 ! Order of Evaluation (denial overrides granted, or vice versa?)
25
26 The array of permissions is evaluated from top to bottom. <br>
27 Access is granted if the next matching *group membership* returns true, denied if false. <br>
28 If the group membership is false, the next group is tried. <br>
29 If no group membership matches the upper permissions are tried recursively: <br>
30   current page => basepage => "." page => default perms. <br>
31 If no group-perm pair grants access, access is denied.
32
33 Consider the following perm:
34 <verbatim>
35      'change' => array(ACL_ADMIN => false,
36                        ACL_OWNER => true));
37 </verbatim>
38   => "Members of ADMIN may not change, the owner may change."
39
40 -----
41
42 For Authentication see ~WikiUserNew.php, ~WikiGroup.php and main.php
43 Page Permissions are in PhpWiki since v1.3.9. 
44 I suspect ACL page permissions to degrade performance by 10%
45
46 Enable/Disable it in config/config.ini:
47
48   ENABLE_PAGEPERM = true
49
50 The defined (and extendable) main.php actions map to simplier access types:
51 <verbatim>
52        browse => view
53        edit   => edit
54        create => edit or create
55        remove => remove
56        rename => change
57        store prefs => change
58        list in PageList => list
59 </verbatim>
60
61 For simplicity we also map the ACL to the posix-style _owner_, _group_ and _world_ groups
62 and _read_, _write_, _execute_ perms, in cygwin fashion.
63
64 !!! Groups - definition of group membership
65
66 See WikiGroup how to enable and where to store user-specific group membership.
67 Group methods: database, file, ldap, wikipage, none
68
69 ToDo: _explain better._
70
71 The following special groups are always predefined, even if no other group methods are provided:
72
73 * _EVERY
74 * _ANONYMOUS
75 * _BOGOUSER
76 * _HASHOMEPAGE
77 * _SIGNED
78 * _AUTHENTICATED
79 * _ADMIN
80 * _OWNER
81 * _CREATOR
82
83 Those special groups are stored in a page acl as locale-independent string.
84   *Todo*: See the available translations for these special groups.
85 Other group names are safed as defined by the group methods. (e.g. "Other Users")
86
87 !!! Perms - mapping of actions to permissions
88
89 PhpWiki supports individual actions, the default is browse. To simplify ACL's these
90 actions are mapped to some special permissions (vulgo _'perms'_).
91
92 We currently support the following permissions which can be stored in every page, for every group.
93
94 * 'list'     List this page and all subpages (for PageList)
95 * 'view'     View this page and all subpages
96 * 'edit'     Edit this page and all subpages
97 * 'create'   Create a new (sub)page
98 * 'dump'     Download the page contents
99 * 'change'   Change page attributes
100 * 'remove'   Remove this page
101
102 There are no plans to support additional custom perms. The API can handle that, but there's no UI,
103 and it would be only specific for certain plugins, which check permissions by their own.
104
105 ! Action <=> Perm mapping
106
107 Those perms are mapped to those actions. ActionPages (plugins) check their access restrictions by themselves.
108
109 list:
110   _none, 'list' is checked for every pagename listed in PageList, to prevent from being listed in AllPages._
111
112 view:
113   browse, viewsource, diff, select, xmlrpc, search, pdf
114
115 dump:
116   zip, ziphtml, dumpserial, dumphtml
117
118 edit:
119   revert, edit
120
121 create:
122   _edit or create, if the page doesn't exist yet_
123
124 change:
125   upload, loadfile, remove, lock, unlock, upgrade, chown, setacl, rename. %%%
126   all other actionpages which are not wikiwords.
127
128 !! Default Permissions
129
130 <verbatim>
131         $perm = array('view'   => array(ACL_EVERY => true),
132                       'edit'   => array(ACL_EVERY => true),
133                       'create' => array(ACL_EVERY => true),
134                       'list'   => array(ACL_EVERY => true),
135                       'remove' => array(ACL_ADMIN => true,
136                                         ACL_OWNER => true),
137                       'change' => array(ACL_ADMIN => true,
138                                         ACL_OWNER => true));
139         if (ZIPDUMP_AUTH)
140             $perm['dump'] = array(ACL_ADMIN => true,
141                                   ACL_OWNER => true);
142         else
143             $perm['dump'] = array(ACL_EVERY => true);
144         // view:
145         if (!ALLOW_ANON_USER) {
146             if (!ALLOW_USER_PASSWORDS)
147                 $perm['view'] = array(ACL_SIGNED => true);
148             else
149                 $perm['view'] = array(ACL_AUTHENTICATED => true);
150             $perm['view'][ACL_BOGOUSER] = ALLOW_BOGO_LOGIN ? true : false;
151         }
152         // edit:
153         if (!ALLOW_ANON_EDIT) {
154             if (!ALLOW_USER_PASSWORDS)
155                 $perm['edit'] = array(ACL_SIGNED => true);
156             else
157                 $perm['edit'] = array(ACL_AUTHENTICATED => true);
158             $perm['edit'][ACL_BOGOUSER] = ALLOW_BOGO_LOGIN ? true : false;
159             $perm['create'] = $perm['edit'];
160         }
161         return $perm;
162 </verbatim>
163
164 Source: [PhpWikiCvs:lib/PagePerm.php]
165 -----
166 PhpWikiDocumentation