2 rcs_id('$Id: PagePerm.php,v 1.36 2004-11-21 11:59:16 rurban Exp $');
4 Copyright 2004 $ThePhpWikiProgrammingTeam
6 This file is part of PhpWiki.
8 PhpWiki is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 PhpWiki is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with PhpWiki; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 Permissions per page and action based on current user,
25 ownership and group membership implemented with ACL's (Access Control Lists),
26 opposed to the simplier unix like ugo:rwx system.
27 The previous system was only based on action and current user. (lib/main.php)
29 Permissions may be inherited from its parent pages, a optional the
30 optional master page ("."), and predefined default permissions, if "."
32 Pagenames starting with "." have special default permissions.
33 For Authentication see WikiUserNew.php, WikiGroup.php and main.php
34 Page Permissions are in PhpWiki since v1.3.9 and enabled since v1.4.0
36 This file might replace the following functions from main.php:
37 Request::_notAuthorized($require_level)
38 display the denied message and optionally a login form
39 to gain higher privileges
40 Request::getActionDescription($action)
41 helper to localize the _notAuthorized message per action,
43 Request::getDisallowedActionDescription($action)
44 helper to localize the _notAuthorized message per action,
46 Request::requiredAuthority($action)
47 returns the needed user level
48 has a hook for plugins on POST
49 Request::requiredAuthorityForAction($action)
50 just returns the level per action, will be replaced with the
53 The defined main.php actions map to simplier access types:
56 create => edit or create
60 list in PageList => list
63 /* Symbolic special ACL groups. Untranslated to be stored in page metadata*/
64 define('ACL_EVERY', '_EVERY');
65 define('ACL_ANONYMOUS', '_ANONYMOUS');
66 define('ACL_BOGOUSER', '_BOGOUSER');
67 define('ACL_HASHOMEPAGE', '_HASHOMEPAGE');
68 define('ACL_SIGNED', '_SIGNED');
69 define('ACL_AUTHENTICATED','_AUTHENTICATED');
70 define('ACL_ADMIN', '_ADMIN');
71 define('ACL_OWNER', '_OWNER');
72 define('ACL_CREATOR', '_CREATOR');
74 // Return an page permissions array for this page.
75 // To provide ui helpers to view and change page permissions:
76 // <tr><th>Group</th><th>Access</th><th>Allow or Forbid</th></tr>
77 // <tr><td>$group</td><td>_($access)</td><td> [ ] </td></tr>
78 function pagePermissions($pagename) {
80 $page = $request->getPage($pagename);
81 // Page not found (new page); returned inherited permissions, to be displayed in gray
82 if (! $page->exists() ) {
83 if ($pagename == '.') // stop recursion
84 return array('default', new PagePermission());
86 return array('inherited', pagePermissions(getParentPage($pagename)));
88 } elseif ($perm = getPagePermissions($page)) {
89 return array('page',$perm);
90 // or no permissions defined; returned inherited permissions, to be displayed in gray
91 } elseif ($pagename == '.') { // stop recursion in pathological case.
92 // "." defined, without any acl
93 return array('default', new PagePermission());
95 return array('inherited', pagePermissions(getParentPage($pagename)));
99 function pagePermissionsSimpleFormat($perm_tree, $owner, $group=false) {
100 list($type,$perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
102 $type = $perm_tree[0];
103 $perm = pagePermissionsAcl($perm_tree);
104 if (is_object($perm_tree[1]))
105 $perm = $perm_tree[1];
106 elseif (is_array($perm_tree[1])) {
107 $perm_tree = pagePermissionsSimpleFormat($perm_tree[1],$owner,$group);
108 if (isa($perm_tree[1],'pagepermission'))
109 $perm = $perm_tree[1];
110 elseif (isa($perm_tree,'htmlelement'))
115 return HTML::tt(HTML::strong($perm->asRwxString($owner, $group)));
116 elseif ($type == 'default')
117 return HTML::tt($perm->asRwxString($owner, $group));
118 elseif ($type == 'inherited') {
119 return HTML::tt(array('class'=>'inherited', 'style'=>'color:#aaa;'),
120 $perm->asRwxString($owner, $group));
124 function pagePermissionsAcl($type,$perm_tree) {
125 $perm = $perm_tree[1];
126 while (!is_object($perm)) {
127 $perm_tree = pagePermissionsAcl($type, $perm);
128 $perm = $perm_tree[1];
130 return array($type,$perm);
135 function pagePermissionsAclFormat($perm_tree, $editable=false) {
136 list($type,$perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
138 return $perm->asEditableTable($type);
140 return $perm->asTable($type);
144 * Check the permissions for the current action.
145 * Walk down the inheritance tree. Collect all permissions until
146 * the minimum required level is gained, which is not
147 * overruled by more specific forbid rules.
148 * Todo: cache result per access and page in session?
150 function requiredAuthorityForPage ($action) {
152 $auth = _requiredAuthorityForPagename(action2access($action),
153 $request->getArg('pagename'));
154 assert($auth !== -1);
156 return $request->_user->_level;
158 return WIKIAUTH_UNOBTAINABLE;
161 // Translate action or plugin to the simplier access types:
162 function action2access ($action) {
182 $page = $request->getPage();
183 if (!$page->exists())
190 // probably create/edit but we cannot check all page permissions, can we?
200 //Todo: Plugins should be able to override its access type
201 if (isWikiWord($action))
209 // Recursive helper to do the real work
210 // TODO: check if a perm cache for page-(current+edit+change?)action pairs will help
211 function _requiredAuthorityForPagename($access, $pagename) {
212 static $permcache = array();
214 if (array_key_exists($pagename, $permcache)
215 and array_key_exists($access, $permcache[$pagename]))
216 return $permcache[$pagename][$access];
219 $page = $request->getPage($pagename);
220 // Page not found; check against default permissions
221 if (! $page->exists() ) {
222 $perm = new PagePermission();
223 $result = ($perm->isAuthorized($access, $request->_user) === true);
224 $permcache[$pagename][$access] = $result;
227 // no ACL defined; check for special dotfile or walk down
228 if (! ($perm = getPagePermissions($page))) {
229 if ($pagename == '.') {
230 $perm = new PagePermission();
231 if ($perm->isAuthorized('change', $request->_user)) {
232 // warn the user to set ACL of ".", if he has permissions to do so.
233 trigger_error(". (dotpage == rootpage for inheriting pageperm ACLs) exists without any ACL!\n".
234 "Please do ?action=setacl&pagename=.", E_USER_WARNING);
236 $result = ($perm->isAuthorized($access, $request->_user) === true);
237 $permcache[$pagename][$access] = $result;
239 } elseif ($pagename[0] == '.') {
240 $perm = new PagePermission(PagePermission::dotPerms());
241 $result = ($perm->isAuthorized($access, $request->_user) === true);
242 $permcache[$pagename][$access] = $result;
245 return _requiredAuthorityForPagename($access, getParentPage($pagename));
247 // ACL defined; check if isAuthorized returns true or false or undecided
248 $authorized = $perm->isAuthorized($access, $request->_user);
249 if ($authorized !== -1) { // interestingly true is also -1
250 $permcache[$pagename][$access] = $authorized;
252 } elseif ($pagename == '.') {
255 return _requiredAuthorityForPagename($access, getParentPage($pagename));
260 * @param string $pagename page from which the parent page is searched.
261 * @return string parent pagename or the (possibly pseudo) dot-pagename.
263 function getParentPage($pagename) {
264 if (isSubPage($pagename)) {
265 return subPageSlice($pagename,0);
271 // Read the ACL from the page
272 // Done: Not existing pages should NOT be queried.
273 // Check the parent page instead and don't take the default ACL's
274 function getPagePermissions ($page) {
275 if ($hash = $page->get('perm')) // hash => object
276 return new PagePermission(unserialize($hash));
281 // Store the ACL in the page
282 function setPagePermissions ($page,$perm) {
286 function getAccessDescription($access) {
287 static $accessDescriptions;
288 if (! $accessDescriptions) {
289 $accessDescriptions = array(
290 'list' => _("List this page and all subpages"),
291 'view' => _("View this page and all subpages"),
292 'edit' => _("Edit this page and all subpages"),
293 'create' => _("Create a new (sub)page"),
294 'dump' => _("Download the page contents"),
295 'change' => _("Change page attributes"),
296 'remove' => _("Remove this page"),
299 if (in_array($access, array_keys($accessDescriptions)))
300 return $accessDescriptions[$access];
306 function array_diff_assoc_recursive($array1, $array2) {
307 foreach ($array1 as $key => $value) {
308 if (is_array($value)) {
309 if (!is_array($array2[$key])) {
310 $difference[$key] = $value;
312 $new_diff = array_diff_assoc_recursive($value, $array2[$key]);
313 if ($new_diff != false) {
314 $difference[$key] = $new_diff;
317 } elseif(!isset($array2[$key]) || $array2[$key] != $value) {
318 $difference[$key] = $value;
321 return !isset($difference) ? 0 : $difference;
325 * The ACL object per page. It is stored in a page, but can also
326 * be merged with ACL's from other pages or taken from the master (pseudo) dot-file.
328 * A hash of "access" => "requires" pairs.
329 * "access" is a shortcut for common actions, which map to main.php actions
330 * "requires" required username or groupname or any special group => true or false
332 * Define any special rules here, like don't list dot-pages.
334 class PagePermission {
337 function PagePermission($hash = array()) {
338 $this->_group = &$GLOBALS['request']->getGroup();
339 if (is_array($hash) and !empty($hash)) {
340 $accessTypes = $this->accessTypes();
341 foreach ($hash as $access => $requires) {
342 if (in_array($access, $accessTypes))
343 $this->perm[$access] = $requires;
345 trigger_error(sprintf(_("Unsupported ACL access type %s ignored."), $access),
349 // set default permissions, the so called dot-file acl's
350 $this->perm = $this->defaultPerms();
356 * The workhorse to check the user against the current ACL pairs.
357 * Must translate the various special groups to the actual users settings
358 * (userid, group membership).
360 function isAuthorized($access,$user) {
361 if (!empty($this->perm{$access})) {
362 foreach ($this->perm[$access] as $group => $bool) {
363 if ($this->isMember($user,$group)) {
368 return -1; // undecided
372 * Translate the various special groups to the actual users settings
373 * (userid, group membership).
375 function isMember($user, $group) {
377 if ($group === ACL_EVERY) return true;
378 if (!isset($this->_group)) $member =& $request->getGroup();
379 else $member =& $this->_group;
380 //$user = & $request->_user;
381 if ($group === ACL_ADMIN) // WIKI_ADMIN or member of _("Administrators")
382 return $user->isAdmin() or
383 ($user->isAuthenticated() and
384 $member->isMember(GROUP_ADMIN));
385 if ($group === ACL_ANONYMOUS)
386 return ! $user->isSignedIn();
387 if ($group === ACL_BOGOUSER)
389 return isa($user,'_BogoUser') or
390 (isWikiWord($user->_userid) and $user->_level >= WIKIAUTH_BOGO);
391 else return isWikiWord($user->UserName());
392 if ($group === ACL_HASHOMEPAGE)
393 return $user->hasHomePage();
394 if ($group === ACL_SIGNED)
395 return $user->isSignedIn();
396 if ($group === ACL_AUTHENTICATED)
397 return $user->isAuthenticated();
398 if ($group === ACL_OWNER) {
399 $page = $request->getPage();
400 return ($user->isAuthenticated() and
401 $page->getOwner() === $user->UserName());
403 if ($group === ACL_CREATOR) {
404 $page = $request->getPage();
405 return ($user->isAuthenticated() and
406 $page->getCreator() === $user->UserName());
408 /* Or named groups or usernames.
409 Note: We don't seperate groups and users here.
410 Users overrides groups with the same name.
412 return $user->UserName() === $group or
413 $member->isMember($group);
417 * returns hash of default permissions.
418 * check if the page '.' exists and returns this instead.
420 function defaultPerms() {
421 //Todo: check for the existance of '.' and take this instead.
422 //Todo: honor more config.ini auth settings here
423 $perm = array('view' => array(ACL_EVERY => true),
424 'edit' => array(ACL_EVERY => true),
425 'create' => array(ACL_EVERY => true),
426 'list' => array(ACL_EVERY => true),
427 'remove' => array(ACL_ADMIN => true,
429 'change' => array(ACL_ADMIN => true,
432 $perm['dump'] = array(ACL_ADMIN => true,
435 $perm['dump'] = array(ACL_EVERY => true);
436 if (defined('REQUIRE_SIGNIN_BEFORE_EDIT') && REQUIRE_SIGNIN_BEFORE_EDIT)
437 $perm['edit'] = array(ACL_SIGNED => true);
439 if (!ALLOW_ANON_USER) {
440 if (!ALLOW_USER_PASSWORDS)
441 $perm['view'] = array(ACL_SIGNED => true);
443 $perm['view'] = array(ACL_AUTHENTICATED => true);
444 $perm['view'][ACL_BOGOUSER] = ALLOW_BOGO_LOGIN ? true : false;
447 if (!ALLOW_ANON_EDIT) {
448 if (!ALLOW_USER_PASSWORDS)
449 $perm['edit'] = array(ACL_SIGNED => true);
451 $perm['edit'] = array(ACL_AUTHENTICATED => true);
452 $perm['edit'][ACL_BOGOUSER] = ALLOW_BOGO_LOGIN ? true : false;
453 $perm['create'] = $perm['edit'];
459 * FIXME: check valid groups and access
462 foreach ($this->perm as $access => $groups) {
463 foreach ($groups as $group => $bool) {
464 $this->perm[$access][$group] = (boolean) $bool;
470 * do a recursive comparison
472 function equal($otherperm) {
473 $diff = array_diff_assoc_recursive($this->perm, $otherperm);
478 * returns list of all supported access types.
480 function accessTypes() {
481 return array_keys(PagePermission::defaultPerms());
485 * special permissions for dot-files, beginning with '.'
486 * maybe also for '_' files?
488 function dotPerms() {
489 $def = array(ACL_ADMIN => true,
492 foreach (PagePermission::accessTypes() as $access) {
493 $perm[$access] = $def;
499 * dead code. not needed inside the object. see getPagePermissions($page)
501 function retrieve($page) {
502 $hash = $page->get('perm');
503 if ($hash) // hash => object
504 $perm = new PagePermission(unserialize($hash));
506 $perm = new PagePermission();
511 function store($page) {
514 return $page->set('perm',serialize($this->perm));
517 function groupName ($group) {
518 if ($group[0] == '_') return constant("GROUP".$group);
522 /* type: page, default, inherited */
523 function asTable($type) {
524 $table = HTML::table();
525 foreach ($this->perm as $access => $perms) {
526 $td = HTML::table(array('class' => 'cal','valign' => 'top'));
527 foreach ($perms as $group => $bool) {
528 $td->pushContent(HTML::tr(HTML::td(array('align'=>'right'),$group),
529 HTML::td($bool ? '[X]' : '[ ]')));
531 $table->pushContent(HTML::tr(array('valign' => 'top'),
532 HTML::td($access),HTML::td($td)));
534 if ($type == 'default')
535 $table->setAttr('style','border: dotted thin black; background-color:#eee;');
536 elseif ($type == 'inherited')
537 $table->setAttr('style','border: dotted thin black; background-color:#ddd;');
538 elseif ($type == 'page')
539 $table->setAttr('style','border: solid thin black; font-weight: bold;');
543 /* type: page, default, inherited */
544 function asEditableTable($type) {
546 if (!isset($this->_group)) {
547 $this->_group =& $GLOBALS['request']->getGroup();
549 $table = HTML::table();
550 $table->pushContent(HTML::tr(
551 HTML::th(array('align' => 'left'),
553 HTML::th(array('align'=>'right'),
555 HTML::th(_("Grant")),
556 HTML::th(_("Del/+")),
557 HTML::th(_("Description"))));
559 $allGroups = $this->_group->_specialGroups();
560 foreach ($this->_group->getAllGroupsIn() as $group) {
561 if (!in_array($group,$this->_group->specialGroups()))
562 $allGroups[] = $group;
564 //array_unique(array_merge($this->_group->getAllGroupsIn(),
565 $deletesrc = $WikiTheme->_findData('images/delete.png');
566 $addsrc = $WikiTheme->_findData('images/add.png');
567 $nbsp = HTML::raw(' ');
568 foreach ($this->perm as $access => $groups) {
569 //$permlist = HTML::table(array('class' => 'cal','valign' => 'top'));
571 $newperm = HTML::input(array('type' => 'checkbox',
572 'name' => "acl[_new_perm][$access]",
574 $addbutton = HTML::input(array('type' => 'checkbox',
575 'name' => "acl[_add_group][$access]",
578 'title' => _("Add this ACL"),
580 $newgroup = HTML::select(array('name' => "acl[_new_group][$access]",
581 'style'=> 'text-align: right;',
583 foreach ($allGroups as $groupname) {
584 if (!isset($groups[$groupname]))
585 $newgroup->pushContent(HTML::option(array('value' => $groupname),
586 $this->groupName($groupname)));
588 if (empty($groups)) {
589 $addbutton->setAttr('checked','checked');
590 $newperm->setAttr('checked','checked');
592 HTML::tr(array('valign' => 'top'),
593 HTML::td(HTML::strong($access.":")),
595 HTML::td($nbsp,$newperm),
596 HTML::td($nbsp,$addbutton),
597 HTML::td(HTML::em(getAccessDescription($access)))));
599 foreach ($groups as $group => $bool) {
600 $checkbox = HTML::input(array('type' => 'checkbox',
601 'name' => "acl[$access][$group]",
602 'title' => _("Allow / Deny"),
604 if ($bool) $checkbox->setAttr('checked','checked');
605 $checkbox = HTML(HTML::input(array('type' => 'hidden',
606 'name' => "acl[$access][$group]",
609 $deletebutton = HTML::input(array('type' => 'checkbox',
610 'name' => "acl[_del_group][$access][$group]",
611 'style' => 'background: #aaa url('.$deletesrc.')',
612 //'src' => $deletesrc,
614 'title' => _("Delete this ACL"),
619 HTML::td(HTML::strong($access.":")),
620 HTML::td(array('class' => 'cal-today','align'=>'right'),
621 HTML::strong($this->groupName($group))),
622 HTML::td(array('align'=>'center'),$nbsp,$checkbox),
623 HTML::td(array('align'=>'right','style' => 'background: #aaa url('.$deletesrc.') no-repeat'),$deletebutton),
624 HTML::td(HTML::em(getAccessDescription($access)))));
630 HTML::td(array('class' => 'cal-today','align'=>'right'),
631 HTML::strong($this->groupName($group))),
632 HTML::td(array('align'=>'center'),$nbsp,$checkbox),
633 HTML::td(array('align'=>'right','style' => 'background: #aaa url('.$deletesrc.') no-repeat'),$deletebutton),
639 HTML::tr(array('valign' => 'top'),
640 HTML::td(array('align'=>'right'),_("add ")),
642 HTML::td(array('align'=>'center'),$nbsp,$newperm),
643 HTML::td(array('align'=>'right','style' => 'background: #ccc url('.$addsrc.') no-repeat'),$addbutton),
644 HTML::td(HTML::small(_("Check to add this Acl")))));
646 if ($type == 'default')
647 $table->setAttr('style','border: dotted thin black; background-color:#eee;');
648 elseif ($type == 'inherited')
649 $table->setAttr('style','border: dotted thin black; background-color:#ddd;');
650 elseif ($type == 'page')
651 $table->setAttr('style','border: solid thin black; font-weight: bold;');
655 // Print ACL as lines of [+-]user[,group,...]:access[,access...]
656 // Seperate acl's by "; " or whitespace
657 // See http://opag.ca/wiki/HelpOnAccessControlLists
658 // As used by WikiAdminSetAclSimple
659 function asAclLines() {
662 foreach ($this->perm as $access => $groups) {
663 // unify groups for same access+bool
664 // view:CREATOR,-OWNER,
666 foreach ($groups as $group => $bool) {
667 $line .= ($bool?'':'-').$group.",";
669 if (substr($line,-1) == ',')
670 $s .= substr($line,0,-1)."; ";
672 if (substr($s,-2) == '; ')
673 $s = substr($s,0,-2);
678 // This is just a bad hack for testing.
679 // Simplify the ACL to a unix-like "rwx------+" string
681 function asRwxString($owner,$group=false) {
683 // simplify object => rwxrw---x+ string as in cygwin (+ denotes additional ACLs)
684 $perm =& $this->perm;
685 // get effective user and group
687 if (isset($perm['view'][$owner]) or
688 (isset($perm['view'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
690 if (isset($perm['edit'][$owner]) or
691 (isset($perm['edit'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
693 if (isset($perm['change'][$owner]) or
694 (isset($perm['change'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
696 if (!empty($group)) {
697 if (isset($perm['view'][$group]) or
698 (isset($perm['view'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
700 if (isset($perm['edit'][$group]) or
701 (isset($perm['edit'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
703 if (isset($perm['change'][$group]) or
704 (isset($perm['change'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
707 if (isset($perm['view'][ACL_EVERY]) or
708 (isset($perm['view'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
710 if (isset($perm['edit'][ACL_EVERY]) or
711 (isset($perm['edit'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
713 if (isset($perm['change'][ACL_EVERY]) or
714 (isset($perm['change'][ACL_AUTHENTICATED]) and $request->_user->isAuthenticated()))
720 // $Log: not supported by cvs2svn $
721 // Revision 1.35 2004/11/15 15:56:40 rurban
722 // don't load PagePerm on ENABLE_PAGEPERM = false to save memory. Move mayAccessPage() to main.php
724 // Revision 1.34 2004/11/01 10:43:55 rurban
725 // seperate PassUser methods into seperate dir (memory usage)
726 // fix WikiUser (old) overlarge data session
727 // remove wikidb arg from various page class methods, use global ->_dbi instead
730 // Revision 1.33 2004/09/26 11:47:52 rurban
731 // fix another reecursion loop when . exists: deny if ACL not defined; implement pageperm cache
733 // Revision 1.32 2004/09/25 18:56:09 rurban
734 // avoid recursion bug on setacl for "."
736 // Revision 1.31 2004/09/25 18:34:45 rurban
737 // fix and warn on too restrictive ACL handling without ACL in existing . (dotpage)
739 // Revision 1.30 2004/09/25 16:24:02 rurban
740 // fix interesting PagePerm problem: -1 == true
742 // Revision 1.29 2004/07/03 08:04:19 rurban
743 // fixed implicit PersonalPage login (e.g. on edit), fixed to check against create ACL on create, not edit
745 // Revision 1.28 2004/06/25 14:29:17 rurban
746 // WikiGroup refactoring:
747 // global group attached to user, code for not_current user.
748 // improved helpers for special groups (avoid double invocations)
749 // new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write())
750 // fixed a XHTML validation error on userprefs.tmpl
752 // Revision 1.27 2004/06/16 10:38:58 rurban
753 // Disallow refernces in calls if the declaration is a reference
754 // ("allow_call_time_pass_reference clean").
755 // PhpWiki is now allow_call_time_pass_reference = Off clean,
756 // but several external libraries may not.
757 // In detail these libs look to be affected (not tested):
761 // Revision 1.26 2004/06/14 11:31:36 rurban
762 // renamed global $Theme to $WikiTheme (gforge nameclash)
763 // inherit PageList default options from PageList
764 // default sortby=pagename
765 // use options in PageList_Selectable (limit, sortby, ...)
766 // added action revert, with button at action=diff
767 // added option regex to WikiAdminSearchReplace
769 // Revision 1.25 2004/06/08 13:51:57 rurban
770 // some comments only
772 // Revision 1.24 2004/06/08 10:54:46 rurban
773 // better acl dump representation, read back acl and owner
775 // Revision 1.23 2004/06/08 10:05:11 rurban
776 // simplified admin action shortcuts
778 // Revision 1.22 2004/06/07 22:44:14 rurban
779 // added simplified chown, setacl actions
781 // Revision 1.21 2004/06/07 22:28:03 rurban
782 // add acl field to mimified dump
784 // Revision 1.20 2004/06/07 18:39:03 rurban
785 // support for SetAclSimple
787 // Revision 1.19 2004/06/06 17:12:28 rurban
788 // fixed PagePerm non-object problem (mayAccessPage), also bug #967150
790 // Revision 1.18 2004/05/27 17:49:05 rurban
791 // renamed DB_Session to DbSession (in CVS also)
792 // added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals
793 // remove leading slash in error message
794 // added force_unlock parameter to File_Passwd (no return on stale locks)
795 // fixed adodb session AffectedRows
796 // added FileFinder helpers to unify local filenames and DATA_PATH names
797 // editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR
799 // Revision 1.17 2004/05/16 23:10:44 rurban
800 // update_locale wrongly resetted LANG, which broke japanese.
801 // japanese now correctly uses EUC_JP, not utf-8.
802 // more charset and lang headers to help the browser.
804 // Revision 1.16 2004/05/16 22:32:53 rurban
807 // Revision 1.15 2004/05/16 22:07:35 rurban
808 // check more config-default and predefined constants
809 // various PagePerm fixes:
810 // fix default PagePerms, esp. edit and view for Bogo and Password users
811 // implemented Creator and Owner
812 // BOGOUSERS renamed to BOGOUSER
813 // fixed syntax errors in signin.tmpl
815 // Revision 1.14 2004/05/15 22:54:49 rurban
816 // fixed important WikiDB bug with DEBUG > 0: wrong assertion
817 // improved SetAcl (works) and PagePerms, some WikiGroup helpers.
819 // Revision 1.13 2004/05/15 19:48:33 rurban
820 // fix some too loose PagePerms for signed, but not authenticated users
821 // (admin, owner, creator)
822 // no double login page header, better login msg.
823 // moved action_pdf to lib/pdf.php
825 // Revision 1.12 2004/05/04 22:34:25 rurban
828 // Revision 1.11 2004/05/02 21:26:38 rurban
829 // limit user session data (HomePageHandle and auth_dbi have to invalidated anyway)
830 // because they will not survive db sessions, if too large.
831 // extended action=upgrade
832 // some WikiTranslation button work
833 // revert WIKIAUTH_UNOBTAINABLE (need it for main.php)
834 // some temp. session debug statements
836 // Revision 1.10 2004/04/29 22:32:56 zorloc
837 // Slightly more elegant fix. Instead of WIKIAUTH_FORBIDDEN, the current user's level + 1 is returned on a false.
839 // Revision 1.9 2004/04/29 17:18:19 zorloc
840 // Fixes permission failure issues. With PagePermissions and Disabled Actions when user did not have permission WIKIAUTH_FORBIDDEN was returned. In WikiUser this was ok because WIKIAUTH_FORBIDDEN had a value of 11 -- thus no user could perform that action. But WikiUserNew has a WIKIAUTH_FORBIDDEN value of -1 -- thus a user without sufficent permission to do anything. The solution is a new high value permission level (WIKIAUTH_UNOBTAINABLE) to be the default level for access failure.
842 // Revision 1.8 2004/03/14 16:24:35 rurban
843 // authenti(fi)cation spelling
845 // Revision 1.7 2004/02/28 22:25:07 rurban
846 // First PagePerm implementation:
848 // $WikiTheme->setAnonEditUnknownLinks(false);
850 // Layout improvement with dangling links for mostly closed wiki's:
851 // If false, only users with edit permissions will be presented the
852 // special wikiunknown class with "?" and Tooltip.
853 // If true (default), any user will see the ?, but will be presented
854 // the PrintLoginForm on a click.
856 // Revision 1.6 2004/02/24 15:20:05 rurban
857 // fixed minor warnings: unchecked args, POST => Get urls for sortby e.g.
859 // Revision 1.5 2004/02/23 21:30:25 rurban
860 // more PagePerm stuff: (working against 1.4.0)
861 // ACL editing and simplification of ACL's to simple rwx------ string
864 // Revision 1.4 2004/02/12 13:05:36 rurban
865 // Rename functional for PearDB backend
866 // some other minor changes
867 // SiteMap comes with a not yet functional feature request: includepages (tbd)
869 // Revision 1.3 2004/02/09 03:58:12 rurban
870 // for now default DB_SESSION to false
872 // * not existing perms will now query the parent, and not
873 // return the default perm
874 // * added pagePermissions func which returns the object per page
875 // * added getAccessDescription
877 // * added global ->prepare (not yet used) with smart user/pref/member table prefixing.
878 // * force init of authdbh in the 2 db classes
880 // * fixed session handling (not triple auth request anymore)
881 // * don't store cookie prefs with sessions
882 // stdlib: global obj2hash helper from _AuthInfo, also needed for PagePerm
884 // Revision 1.2 2004/02/08 13:17:48 rurban
885 // This should be the functionality. Needs testing and some minor todos.
887 // Revision 1.1 2004/02/08 12:29:30 rurban
888 // initial version, not yet hooked into lib/main.php
896 // c-hanging-comment-ender-p: nil
897 // indent-tabs-mode: nil