*/ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'admin.php'); /** * All DokuWiki plugins to extend the admin function * need to inherit from this class */ class admin_plugin_permissioninfo extends DokuWiki_Admin_Plugin { /** * If information about which user is in which group is displayed */ var $show_group_info = true; /** * return sort order for position in admin menu */ function getMenuSort() { return 145; } /** * handle user request */ function handle() { global $conf; global $auth; global $INPUT; $this->auth = $auth; // If the auth class can't list users or groups, retrieve user and group information from ACL if($this->auth->canDo('getUsers')) { $getUserFunc = array($this->auth, 'retrieveUsers'); } else { // Can't determine user/group association from ACL $this->show_group_info = false; $getUserFunc = array($this, "_getUsersFromACL"); } if($this->auth->canDo('getGroups')) $getGroupFunc = array($this->auth, 'retrieveGroups'); else $getGroupFunc = array($this, '_getGroupsFromACL'); // Collect user and group names $this->users = call_user_func($getUserFunc); $this->groups = call_user_func($getGroupFunc); ksort($this->groups); // Get permissions for each group and set the data in $this->aclGroupPermissions $this->_aclGroupPermissions(); // Get explicit user permissions from ACL and set the data in $this->aclUserPermissions $this->_aclUserPermissions(); // Associate groups with users and set the data in $this->group2user $this->_group2user(); // If we show permissions for an individual user, collect its permissions if($INPUT->has('show') && $INPUT->has('user')) { $this->_userPermissions($INPUT->str('user')); } } /** * output Overview page with groups or permissionpage for individual user, all * depending on $_REQUEST['show'] */ function html() { global $INPUT; switch($INPUT->str('show','overview')) { case 'userpermissions': $this->_showUserPermissions(); break; case 'overview': default: $this->_groupOverview(); } } /** * Shows an overview for users in groups and permissions assigned to groups */ function _groupOverview() { $id = cleanID($this->getLang('menu')); ptln('
'.$this->getLang('pi_to_overview')."
"); ptln('".$this->getLang('pi_resource')." | "; foreach($displayed_permissions as $p) $s .= "".$this->getLang('acl_perm'.$p).""; ptln($s." | ||
---|---|---|---|
'.$item.' | ', 9); else ptln(''.$item.' | ',9); foreach($displayed_permissions as $p) { if($p & $perm) ptln('X | ', 9); else ptln('- | ', 9); } $even = !$even; } ptln("