From: <var...@us...> - 2010-08-13 13:34:33
|
Revision: 7644 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7644&view=rev Author: vargenau Date: 2010-08-13 13:34:26 +0000 (Fri, 13 Aug 2010) Log Message: ----------- New plugin: WikiAdminSetAclSimple Modified Paths: -------------- trunk/lib/IniConfig.php trunk/lib/main.php trunk/pgsrc/Help%2FPagePermissions trunk/pgsrc/PhpWikiAdministration trunk/pgsrc/PhpWikiAdministration%2FSetAcl trunk/themes/gforge/pgsrc/PhpWikiAdministration trunk/themes/gforge/templates/actionbar.tmpl Added Paths: ----------- trunk/lib/plugin/WikiAdminSetAclSimple.php trunk/pgsrc/Help%2FWikiAdminSetAclSimplePlugin trunk/pgsrc/PhpWikiAdministration%2FSetAclSimple trunk/pgsrc/SetGlobalAccessRights trunk/pgsrc/SetGlobalAccessRightsSimple Modified: trunk/lib/IniConfig.php =================================================================== --- trunk/lib/IniConfig.php 2010-08-12 14:54:41 UTC (rev 7643) +++ trunk/lib/IniConfig.php 2010-08-13 13:34:26 UTC (rev 7644) @@ -700,6 +700,7 @@ $AllAllowedPlugins[] = 'WikiAdminRename'; $AllAllowedPlugins[] = 'WikiAdminSearchReplace'; $AllAllowedPlugins[] = 'WikiAdminSetAcl'; + $AllAllowedPlugins[] = 'WikiAdminSetAclSimple'; $AllAllowedPlugins[] = 'WikiAdminUtils'; $AllAllowedPlugins[] = 'WikicreoleTable'; $AllAllowedPlugins[] = 'WikiForm'; @@ -763,9 +764,12 @@ $AllActionPages[] = 'PhpWikiAdministration/Rename'; $AllActionPages[] = 'PhpWikiAdministration/SearchReplace'; $AllActionPages[] = 'PhpWikiAdministration/SetAcl'; + $AllActionPages[] = 'PhpWikiAdministration/SetAclSimple'; $AllActionPages[] = 'RecentChangesMyPages'; $AllActionPages[] = 'RecentEdits'; $AllActionPages[] = 'RecentNewPages'; + $AllActionPages[] = 'SetGlobalAccessRights'; + $AllActionPages[] = 'SetGlobalAccessRightsSimple'; $AllActionPages[] = 'UserContribs'; // The GFORGE theme omits them Modified: trunk/lib/main.php =================================================================== --- trunk/lib/main.php 2010-08-12 14:54:41 UTC (rev 7643) +++ trunk/lib/main.php 2010-08-13 13:34:26 UTC (rev 7644) @@ -717,6 +717,7 @@ case 'upgrade': case 'chown': case 'setacl': + case 'setaclsimple': return WIKIAUTH_ADMIN; /* authcheck occurs only in the plugin. @@ -1087,6 +1088,10 @@ $this->adminActionSubpage(_("SetAcl")); } + function action_setaclsimple () { + $this->adminActionSubpage(_("SetAclSimple")); + } + function action_rename () { $this->adminActionSubpage(_("Rename")); } @@ -1410,9 +1415,10 @@ //$x = error_reporting(); // DEBUG: why is it 1 here? should be E_ALL if (defined('E_STRICT') and (E_ALL & E_STRICT)) // strict php5? - error_reporting(E_ALL & ~E_STRICT); // exclude E_STRICT + error_reporting(E_ALL & ~E_STRICT); // exclude E_STRICT else - error_reporting(E_ALL); // php4 + error_reporting(E_ALL); // php4 + // don't run the main loop for special requests (test, getimg, xmlrpc, soap, ...) if (!defined('PHPWIKI_NOMAIN') or !PHPWIKI_NOMAIN) main(); Added: trunk/lib/plugin/WikiAdminSetAclSimple.php =================================================================== --- trunk/lib/plugin/WikiAdminSetAclSimple.php (rev 0) +++ trunk/lib/plugin/WikiAdminSetAclSimple.php 2010-08-13 13:34:26 UTC (rev 7644) @@ -0,0 +1,181 @@ +<?php // -*-php-*- +// rcs_id('$Id$'); +/* + * Copyright 2004 $ThePhpWikiProgrammingTeam + * Copyright 2009-2010 Marc-Etienne Vargenau, Alcatel-Lucent + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + * Set simple individual PagePermissions + * + * Usage: <<WikiAdminSetAclSimple >> or called via WikiAdminSelect + * Author: Marc-Etienne Vargenau, Alcatel-Lucent + * + */ + +require_once('lib/plugin/WikiAdminSetAcl.php'); + +class WikiPlugin_WikiAdminSetAclSimple +extends WikiPlugin_WikiAdminSetAcl +{ + function getName() { + return _("WikiAdminSetAclSimple"); + } + + function getDescription() { + return _("Set simple individual page permissions."); + } + + function run($dbi, $argstr, &$request, $basepage) { + if ($request->getArg('action') != 'browse') + if ($request->getArg('action') != _("PhpWikiAdministration/SetAclSimple")) + return $this->disabled("(action != 'browse')"); + if (!ENABLE_PAGEPERM) + return $this->disabled("ENABLE_PAGEPERM = false"); + + $args = $this->getArgs($argstr, $request); + $this->_args = $args; + $this->preSelectS($args, $request); + + $p = $request->getArg('p'); + $post_args = $request->getArg('admin_setacl'); + $pages = array(); + if ($p && !$request->isPost()) + $pages = $p; + elseif ($this->_list) + $pages = $this->_list; + $header = HTML::fieldset(); + if ($p && $request->isPost() && + (!empty($post_args['aclliberal']) || !empty($post_args['aclrestricted']))) { + // without individual PagePermissions: + if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { + $request->_notAuthorized(WIKIAUTH_ADMIN); + $this->disabled("! user->isAdmin"); + } + if (!empty($post_args['aclliberal'])) { + return $this->setaclPages($request, array_keys($p), $this->liberalPerms()); + } else if (!empty($post_args['aclrestricted'])) { + return $this->setaclPages($request, array_keys($p), $this->restrictedPerms()); + } + } + if (empty($pages)) { + // List all pages to select from. + $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); + } + $pagelist = new PageList_Selectable($args['info'], + $args['exclude'], + array('types' => array( + 'acl' + => new _PageList_Column_acl('acl', _("ACL"))))); + + $pagelist->addPageList($pages); + $button_label_liberal = _("Set Liberal Access Rights"); + $button_label_restrictive = _("Set Restrictive Access Rights"); + $header = $this->setaclForm($header, $pages); + $header->pushContent(HTML::legend(_("Select the pages where to change access rights"))); + + $buttons = HTML::p(Button('submit:admin_setacl[aclliberal]', $button_label_liberal, 'wikiadmin'), + Button('submit:admin_setacl[aclrestricted]', $button_label_restrictive, 'wikiadmin')); + $header->pushContent($buttons); + + return HTML::form(array('action' => $request->getPostURL(), + 'method' => 'post'), + $header, + $pagelist->getContent(), + HiddenInputs($request->getArgs(), + false, + array('admin_setacl')), + ENABLE_PAGEPERM + ? '' + : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN))); + } + + /* + * acces rights where everyone can edit + * _EVERY: view edit list create; + * _ADMIN: remove purge dump change; + * _OWNER: remove purge dump change; + */ + + function liberalPerms() { + + $perm = array('view' => array(ACL_EVERY => true), + 'edit' => array(ACL_EVERY => true), + 'create' => array(ACL_EVERY => true), + 'list' => array(ACL_EVERY => true), + 'remove' => array(ACL_ADMIN => true, + ACL_OWNER => true), + 'purge' => array(ACL_ADMIN => true, + ACL_OWNER => true), + 'dump' => array(ACL_ADMIN => true, + ACL_OWNER => true), + 'change' => array(ACL_ADMIN => true, + ACL_OWNER => true)); + return $perm; + } + + /* + * acces rights where only authenticated users can see pages + * _AUTHENTICATED: view edit list create; + * _ADMIN: remove purge dump change; + * _OWNER: remove purge dump change; + * _EVERY: -view -edit -list -create; + */ + + function restrictedPerms() { + + $perm = array('view' => array(ACL_AUTHENTICATED => true, + ACL_EVERY => false), + 'edit' => array(ACL_AUTHENTICATED => true, + ACL_EVERY => false), + 'create' => array(ACL_AUTHENTICATED => true, + ACL_EVERY => false), + 'list' => array(ACL_AUTHENTICATED => true, + ACL_EVERY => false), + 'remove' => array(ACL_ADMIN => true, + ACL_OWNER => true), + 'purge' => array(ACL_ADMIN => true, + ACL_OWNER => true), + 'dump' => array(ACL_ADMIN => true, + ACL_OWNER => true), + 'change' => array(ACL_ADMIN => true, + ACL_OWNER => true)); + return $perm; + } + + function setaclForm(&$header, $pagehash) { + + $pages = array(); + foreach ($pagehash as $name => $checked) { + if ($checked) $pages[] = $name; + } + + $header->pushContent(HTML::strong(_("Selected Pages: ")), HTML::tt(join(', ',$pages)), HTML::br()); + return $header; + } +}; + +// Local Variables: +// mode: php +// tab-width: 8 +// c-basic-offset: 4 +// c-hanging-comment-ender-p: nil +// indent-tabs-mode: nil +// End: +?> Property changes on: trunk/lib/plugin/WikiAdminSetAclSimple.php ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/pgsrc/Help%2FPagePermissions =================================================================== --- trunk/pgsrc/Help%2FPagePermissions 2010-08-12 14:54:41 UTC (rev 7643) +++ trunk/pgsrc/Help%2FPagePermissions 2010-08-13 13:34:26 UTC (rev 7644) @@ -1,4 +1,4 @@ -Date: Tue, 1 Jun 2010 17:01:57 +0000 +Date: Fri, 13 Aug 2010 15:31:59 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC-20100415) X-Rcs-Id: $Id$ Content-Type: application/x-phpwiki; @@ -111,7 +111,7 @@ |= dump | zip, ziphtml, dumpserial, dumphtml |= edit | revert, edit |= create | //edit or create, if the page doesn't exist yet// -|= change | upload, loadfile, remove, lock, unlock, upgrade, chown, setacl, rename. \\ All other actionpages which are not wikiwords. +|= change | upload, loadfile, remove, lock, unlock, upgrade, chown, setacl, setaclsimple, rename. \\ All other actionpages which are not wikiwords. === Default Permissions === Added: trunk/pgsrc/Help%2FWikiAdminSetAclSimplePlugin =================================================================== --- trunk/pgsrc/Help%2FWikiAdminSetAclSimplePlugin (rev 0) +++ trunk/pgsrc/Help%2FWikiAdminSetAclSimplePlugin 2010-08-13 13:34:26 UTC (rev 7644) @@ -0,0 +1,52 @@ +Date: Fri, 13 Aug 2010 15:31:59 +0000 +Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC-20100415) +X-Rcs-Id: $Id$ +Content-Type: application/x-phpwiki; + pagename=Help%2FWikiAdminSetAclSimplePlugin; + flags=PAGE_LOCKED%2CEXTERNAL_PAGE; + markup=2; + charset=UTF-8 +Content-Transfer-Encoding: binary + +The **~WikiAdminSetAclSimple** [[Help:WikiPlugin|plugin]] allows to change access rights on pages. + +== Usage == +{{{ +<<WikiAdminSetAclSimple arguments>> +}}} + +== Arguments == + +{| class="bordered" +|- +! Argument +! Description +! Default value +|- +| **p** +| Pages to select +| //None// +|- +| **info** +| Columns to include in listing +| pagename, perm, mtime, owner, author +|} + +== Example == + +{{{ +<<WikiAdminSetAclSimple s=Temp*>> +}}} + +<<WikiAdminSetAclSimple s=Temp*>> + +== Author == +* [[PhpWiki:ReiniUrban|Reini Urban]] + +== See Also == +* [[PhpWikiAdministration]] + +<noinclude> +---- +[[PhpWikiDocumentation]] [[CategoryWikiPlugin]] +</noinclude> Property changes on: trunk/pgsrc/Help%2FWikiAdminSetAclSimplePlugin ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/pgsrc/PhpWikiAdministration =================================================================== --- trunk/pgsrc/PhpWikiAdministration 2010-08-12 14:54:41 UTC (rev 7643) +++ trunk/pgsrc/PhpWikiAdministration 2010-08-13 13:34:26 UTC (rev 7644) @@ -1,4 +1,4 @@ -Date: Wed, 19 May 2010 18:15:54 +0000 +Date: Fri, 13 Aug 2010 15:31:59 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC-20100415) X-Rcs-Id: $Id$ Content-Type: application/x-phpwiki; @@ -20,8 +20,13 @@ or call the available ~WikiAdmin actions directly: -| [[/Chown]] | [[/Markup]] | [[/Purge]] | [[/Remove]] | [[/Rename]] | [[/SearchReplace]] | [[/SetAcl]] +| [[/Chown]] | [[/Markup]] | [[/Purge]] | [[/Remove]] | [[/Rename]] | [[/SearchReplace]] | [[/SetAcl]] | [[/SetAclSimple]] +== Global Access Rights == + +* [[SetGlobalAccessRightsSimple]] +* [[SetGlobalAccessRights]] + == User Management == === Reset a users password === Modified: trunk/pgsrc/PhpWikiAdministration%2FSetAcl =================================================================== --- trunk/pgsrc/PhpWikiAdministration%2FSetAcl 2010-08-12 14:54:41 UTC (rev 7643) +++ trunk/pgsrc/PhpWikiAdministration%2FSetAcl 2010-08-13 13:34:26 UTC (rev 7644) @@ -1,4 +1,4 @@ -Date: Thu, 15 Apr 2010 16:32:58 +0000 +Date: Fri, 13 Aug 2010 15:31:59 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC-20100415) X-Rcs-Id: $Id$ Content-Type: application/x-phpwiki; @@ -8,6 +8,10 @@ charset=UTF-8 Content-Transfer-Encoding: binary +For simple Access Rights modifications, see **[[phpwiki:?action=setaclsimple|SetAclSimple]]**. + +---- + <<WikiAdminSetAcl>> ---- Added: trunk/pgsrc/PhpWikiAdministration%2FSetAclSimple =================================================================== --- trunk/pgsrc/PhpWikiAdministration%2FSetAclSimple (rev 0) +++ trunk/pgsrc/PhpWikiAdministration%2FSetAclSimple 2010-08-13 13:34:26 UTC (rev 7644) @@ -0,0 +1,18 @@ +Date: Fri, 13 Aug 2010 15:31:59 +0000 +Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC-20100415) +X-Rcs-Id: $Id$ +Content-Type: application/x-phpwiki; + pagename=PhpWikiAdministration%2FSetAclSimple; + flags=PAGE_LOCKED; + markup=2; + charset=UTF-8 +Content-Transfer-Encoding: binary + +For more complex Access Rights modifications, see **[[phpwiki:?action=setacl|SetAcl]]**. + +---- + +<<WikiAdminSetAclSimple>> + +---- +[[CategoryActionPage]] Property changes on: trunk/pgsrc/PhpWikiAdministration%2FSetAclSimple ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/pgsrc/SetGlobalAccessRights =================================================================== --- trunk/pgsrc/SetGlobalAccessRights (rev 0) +++ trunk/pgsrc/SetGlobalAccessRights 2010-08-13 13:34:26 UTC (rev 7644) @@ -0,0 +1,14 @@ +Date: Fri, 13 Aug 2010 15:31:59 +0000 +Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC-20100415) +X-Rcs-Id: $Id$ +Content-Type: application/x-phpwiki; + pagename=SetGlobalAccessRights; + flags=PAGE_LOCKED; + markup=2; + charset=UTF-8 +Content-Transfer-Encoding: binary + +<<WikiAdminSetAcl s=. info=pagename>> + +---- +[[CategoryActionPage]] Property changes on: trunk/pgsrc/SetGlobalAccessRights ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/pgsrc/SetGlobalAccessRightsSimple =================================================================== --- trunk/pgsrc/SetGlobalAccessRightsSimple (rev 0) +++ trunk/pgsrc/SetGlobalAccessRightsSimple 2010-08-13 13:34:26 UTC (rev 7644) @@ -0,0 +1,14 @@ +Date: Fri, 13 Aug 2010 15:31:59 +0000 +Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC-20100415) +X-Rcs-Id: $Id$ +Content-Type: application/x-phpwiki; + pagename=SetGlobalAccessRightsSimple; + flags=PAGE_LOCKED; + markup=2; + charset=UTF-8 +Content-Transfer-Encoding: binary + +<<WikiAdminSetAclSimple s=. info=pagename>> + +---- +[[CategoryActionPage]] Property changes on: trunk/pgsrc/SetGlobalAccessRightsSimple ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/themes/gforge/pgsrc/PhpWikiAdministration =================================================================== --- trunk/themes/gforge/pgsrc/PhpWikiAdministration 2010-08-12 14:54:41 UTC (rev 7643) +++ trunk/themes/gforge/pgsrc/PhpWikiAdministration 2010-08-13 13:34:26 UTC (rev 7644) @@ -1,4 +1,4 @@ -Date: Thu, 15 Jul 2010 16:58:46 +0000 +Date: Fri, 13 Aug 2010 15:31:51 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC-20100415) X-Rcs-Id: $Id$ Content-Type: application/x-phpwiki; @@ -20,8 +20,13 @@ or call the available ~WikiAdmin actions directly: -| [[/Chown]] | [[/Purge]] | [[/Remove]] | [[/Rename]] | [[/SearchReplace]] | [[/SetAcl]] +| [[/Chown]] | [[/Purge]] | [[/Remove]] | [[/Rename]] | [[/SearchReplace]] | [[/SetAcl]] | [[/SetAclSimple]] +== Global Access Rights == + +* [[SetGlobalAccessRightsSimple]] +* [[SetGlobalAccessRights]] + == Cleanup == A Wiki SandBox is very easy to clean. Here you can restore it to Modified: trunk/themes/gforge/templates/actionbar.tmpl =================================================================== --- trunk/themes/gforge/templates/actionbar.tmpl 2010-08-12 14:54:41 UTC (rev 7643) +++ trunk/themes/gforge/templates/actionbar.tmpl 2010-08-13 13:34:26 UTC (rev 7644) @@ -104,7 +104,7 @@ <?php } ?> <?php if ($curuserprefs->get('setaclMenuItem')) { ?> - <td><?php echo Button('setacl', _("Access Rights")) ?></td> + <td><?php echo Button('setaclsimple', _("Access Rights")) ?></td> <td class="spacer"> </td> <?php } ?> <?php } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |