<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="home" title="HomePage" href="HomePage.html" />
<link rel="help" title="HowToUseWiki" href="HowToUseWiki.html" />
<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1" />
<link rel="author" title="The PhpWiki Programming Team" href="http://phpwiki.org/ThePhpWikiProgrammingTeam" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Language" content="en" />
<meta name="robots" content="noindex,nofollow" />
<meta name="language" content="en" />
<meta name="document-type" content="Public" />
<meta name="document-rating" content="General" />
<meta name="generator" content="PhpWiki" />
<meta name="PHPWIKI_VERSION" content="1.3.14" />

<base href="../" />
<link rel="stylesheet" type="text/css" charset="iso-8859-1" href="phpwiki-printer.css" />
<title>PhpWiki - Help  /  Page Permissions</title>
</head>
<body>

<div id="header">
  
<!-- Page title -->
<h1>Help  /  Page Permissions</h1>
</div>
<div id="content">



<div class="wikitext"><h2>Full recursive ACL page permissions support (Solaris / Windows style)</h2>
<p class="tightenable">Boolean permissions per page and action (<b>granted</b> or <b>denied</b>) based on the current users
group membership is implemented with ACL's (Access Control Lists).
Opposed to the simplier unix like ugo:rwx system. <br />
The previous system was only based on action and current user, independent of pages.</p>
<p class="tightenable">A individual page permission may be inherited from its parent pages, and
from an optional master page (&quot;.&quot; or _dotpage'). <br />
Use predefined default permissions, if a &quot;.&quot; page does not exist. <br />
Pagenames starting with &quot;.&quot; have tighter default permissions. (edit, change, list disallowed)</p>
<h4>Order of Evaluation (denial overrides granted, or vice versa?)</h4>
<p class="tightenable bottom">The array of permissions is evaluated from top to bottom. <br />
Access is granted if the next matching <b>group membership</b> returns true, denied if false. <br />
If the group membership is false, the next group is tried. <br />
If no group membership matches the upper permissions are tried recursively: <br /></p>
<blockquote class="tightenable top bottom"><p class="tightenable top bottom">current page =&gt; basepage =&gt; &quot;.&quot; page =&gt; default perms. <br /></p>
</blockquote>
<p class="tightenable top">If no group-perm pair grants access, access is denied.</p>
<p class="tightenable bottom">Consider the following perm:</p>
<pre class="tightenable top bottom">
     'change' =&gt; array(ACL_ADMIN =&gt; false,
                       ACL_OWNER =&gt; true));</pre>
<blockquote class="tightenable top"><p class="tightenable top bottom">=&gt; &quot;Members of ADMIN may not change, the owner may change.&quot;</p>
</blockquote>
<hr />
<p class="tightenable">For Authentication see WikiUserNew.php, WikiGroup.php and main.php
Page Permissions are in <a href="PhpWiki.html" class="wiki">PhpWiki</a> since v1.3.9.
I suspect ACL page permissions to degrade performance by 10%</p>
<dl><dt class="tightenable">Enable/Disable it in config/config.ini</dt>
<dd class="tightenable">ENABLE_PAGEPERM = true</dd>
</dl>
<p class="tightenable bottom">The defined (and extendable) main.php actions map to simplier access types:</p>
<pre class="tightenable top">
       browse =&gt; view
       edit   =&gt; edit
       create =&gt; edit or create
       remove =&gt; remove
       rename =&gt; change
       store prefs =&gt; change
       list in PageList =&gt; list</pre>
<p class="tightenable">For simplicity we also map the ACL to the posix-style <i>owner</i>, <i>group</i> and <i>world</i> groups
and <i>read</i>, <i>write</i>, <i>execute</i> perms, in cygwin fashion.</p>
<h2>Groups - definition of group membership</h2>
<p class="tightenable">See <u title="Empty link to: WikiGroup" onmouseover="window.status=&quot;Empty link to: WikiGroup&quot;; return true;" onmouseout="window.status='';return true;" class="wikiunknown">WikiGroup</u> how to enable and where to store user-specific group membership.
Group methods: database, file, ldap, wikipage, none</p>
<p class="tightenable"><u title="Empty link to: ToDo" onmouseover="window.status=&quot;Empty link to: ToDo&quot;; return true;" onmouseout="window.status='';return true;" class="wikiunknown">ToDo</u>: <i>explain better.</i></p>
<p class="tightenable">The following special groups are always predefined, even if no other group methods are provided:</p>
<ul><li class="tightenable bottom">_EVERY</li>
<li class="tightenable top bottom">_ANONYMOUS</li>
<li class="tightenable top bottom">_BOGOUSER</li>
<li class="tightenable top bottom">_HASHOMEPAGE</li>
<li class="tightenable top bottom">_SIGNED</li>
<li class="tightenable top bottom">_AUTHENTICATED</li>
<li class="tightenable top bottom">_ADMIN</li>
<li class="tightenable top bottom">_OWNER</li>
<li class="tightenable top">_CREATOR</li>
</ul>
<p class="tightenable bottom">Those special groups are stored in a page acl as locale-independent string.</p>
<blockquote class="tightenable top bottom"><p class="tightenable top bottom"><b>Todo</b>: See the available translations for these special groups.</p>
</blockquote>
<p class="tightenable top">Other group names are safed as defined by the group methods. (e.g. &quot;Other Users&quot;)</p>
<h2>Perms - mapping of actions to permissions</h2>
<p class="tightenable"><a href="PhpWiki.html" class="wiki">PhpWiki</a> supports individual actions, the default is browse. To simplify ACL's these
actions are mapped to some special permissions (vulgo <i>'perms'</i>).</p>
<p class="tightenable">We currently support the following permissions which can be stored in every page, for every group.</p>
<ul><li class="tightenable bottom">'list'     List this page and all subpages (for <u title="Empty link to: PageList" onmouseover="window.status=&quot;Empty link to: PageList&quot;; return true;" onmouseout="window.status='';return true;" class="wikiunknown">PageList</u>)</li>
<li class="tightenable top bottom">'view'     View this page and all subpages</li>
<li class="tightenable top bottom">'edit'     Edit this page and all subpages</li>
<li class="tightenable top bottom">'create'   Create a new (sub)page</li>
<li class="tightenable top bottom">'dump'     Download the page contents</li>
<li class="tightenable top bottom">'change'   Change page attributes</li>
<li class="tightenable top">'remove'   Remove this page</li>
</ul>
<p class="tightenable">There are no plans to support additional custom perms. The API can handle that, but there's no UI,
and it would be only specific for certain plugins, which check permissions by their own.</p>
<h4>Action &lt;=&gt; Perm mapping</h4>
<p class="tightenable">Those perms are mapped to those actions. <a href="Help/ActionPage" class="named-interwiki"><span style="white-space: nowrap"><img src="images/interwiki.png" alt="" class="linkicon" border="0" />ActionPages</span></a> (plugins) check their access restrictions by themselves.</p>
<dl><dt class="tightenable bottom">list</dt>
<dd class="tightenable top"><i>none, 'list' is checked for every pagename listed in <u title="Empty link to: PageList" onmouseover="window.status=&quot;Empty link to: PageList&quot;; return true;" onmouseout="window.status='';return true;" class="wikiunknown">PageList</u>, to prevent from being listed in <a href="AllPages.html" class="wiki">AllPages</a>.</i></dd>
<dt class="tightenable bottom">view</dt>
<dd class="tightenable top">browse, viewsource, diff, select, xmlrpc, search, pdf</dd>
<dt class="tightenable bottom">dump</dt>
<dd class="tightenable top">zip, ziphtml, dumpserial, dumphtml</dd>
<dt class="tightenable bottom">edit</dt>
<dd class="tightenable top">revert, edit</dd>
<dt class="tightenable bottom">create</dt>
<dd class="tightenable top"><i>edit or create, if the page doesn't exist yet</i></dd>
<dt class="tightenable bottom">change</dt>
<dd class="tightenable top">upload, loadfile, remove, lock, unlock, upgrade, chown, setacl, rename. <br />
all other actionpages which are not wikiwords.</dd>
</dl>
<h3>Default Permissions</h3>
<pre class="tightenable">
        $perm = array('view'   =&gt; array(ACL_EVERY =&gt; true),
                      'edit'   =&gt; array(ACL_EVERY =&gt; true),
                      'create' =&gt; array(ACL_EVERY =&gt; true),
                      'list'   =&gt; array(ACL_EVERY =&gt; true),
                      'remove' =&gt; array(ACL_ADMIN =&gt; true,
                                        ACL_OWNER =&gt; true),
                      'change' =&gt; array(ACL_ADMIN =&gt; true,
                                        ACL_OWNER =&gt; true));
        if (ZIPDUMP_AUTH)
            $perm['dump'] = array(ACL_ADMIN =&gt; true,
                                  ACL_OWNER =&gt; true);
        else
            $perm['dump'] = array(ACL_EVERY =&gt; true);
        // view:
        if (!ALLOW_ANON_USER) {
            if (!ALLOW_USER_PASSWORDS)
                $perm['view'] = array(ACL_SIGNED =&gt; true);
            else
                $perm['view'] = array(ACL_AUTHENTICATED =&gt; true);
            $perm['view'][ACL_BOGOUSER] = ALLOW_BOGO_LOGIN ? true : false;
        }
        // edit:
        if (!ALLOW_ANON_EDIT) {
            if (!ALLOW_USER_PASSWORDS)
                $perm['edit'] = array(ACL_SIGNED =&gt; true);
            else
                $perm['edit'] = array(ACL_AUTHENTICATED =&gt; true);
            $perm['edit'][ACL_BOGOUSER] = ALLOW_BOGO_LOGIN ? true : false;
            $perm['create'] = $perm['edit'];
        }
        return $perm;</pre>
<p class="tightenable bottom">Source: <a href="http://phpwiki.cvs.sourceforge.net/phpwiki/phpwiki/lib/PagePerm.php" class="interwiki"><span style="white-space: nowrap"><img src="images/interwiki.png" alt="" class="linkicon" border="0" />PhpWikiCvs:</span><span class="wikipage">lib/PagePerm.php</span></a></p>
<hr />
<p class="tightenable top bottom"><a href="PhpWikiDocumentation.html" class="wiki">PhpWikiDocumentation</a></p>
</div>

<div id="footer">  <hr class="printer" noshade="noshade" />
<p class="editdate">Owner: &quot;admin&quot;  Last edited on August 14, 2007  7:11 am by &quot;The PhpWiki programming team&quot;</p>
</div>

</div>
<!-- Add your Disclaimer here -->
</body>
</html>
