return $result ;
}
+
function getThemePath(){
return util_make_url('plugins/'.$this->name.'/themes/default');
}
+
+ function registerRoleValues(&$params, $values) {
+ $role =& $params['role'] ;
+ }
+
+}
+
+class PluginSpecificRoleSetting {
+ var $role ;
+ var $name = '' ;
+ var $section = '' ;
+ var $values = array () ;
+ var $default_values = array () ;
+
+ function PluginSpecificRoleSetting (&$role, $name) {
+ $this->role =& $role ;
+ $this->name = $name ;
+ }
+
+ function SetAllowedValues ($values) {
+ $this->role->role_values = array_replace_recursive ($this->role->role_values,
+ array ($this->name => $values)) ;
+ }
+
+ function SetDefaultValues ($defaults) {
+ foreach ($defaults as $rname => $v) {
+ $this->role->defaults[$rname][$this->name] = $v ;
+ }
+ }
+
+ function setValueDescriptions ($descs) {
+ global $rbac_permission_names ;
+ foreach ($descs as $k => $v) {
+ $rbac_permission_names[$this->name.$k] = $v ;
+ }
+ }
+
+ function setDescription ($desc) {
+ global $rbac_edit_section_names ;
+ $rbac_edit_section_names[$this->name] = $desc ;
+ }
}
// Local Variables:
$hook_params['role'] =& $this;
plugin_hook ("role_get", $hook_params);
- if ($GLOBALS['default_roles']) {
+ if (isset ($GLOBALS['default_roles'])) {
$this->defaults = array_merge_recursive ($this->defaults,
$GLOBALS['default_roles']) ;
foreach ($this->defaults as $k => $v) {
* This file maps symbolic values to localised texts for the role permissions
*/
+require_once $gfcommon.'include/PluginManager.class.php';
+
function setup_rbac_strings () {
global $rbac_permission_names, $rbac_edit_section_names ;
- $rbac_permission_names = array (
+ $rbac_permission_names = array_replace_recursive ($rbac_permission_names,
+ array (
'frspackage0' => _('Private'),
'frspackage1' => _('Public'),
'frspackage' => _('File Release System'),
'webcal2' => _('See'),
'webcal1' => _('Modify'),
'webcal0' => _('No access')
+ )
);
- $rbac_edit_section_names = array (
+ $rbac_edit_section_names = array_replace_recursive ($rbac_edit_section_names,
+ array (
'forum' => _('Forum'),
'newforum' => _('Default for new forums'),
'forumpublic' => _('Forum'),
'scm' => _('SCM'),
'scmpublic' => _('SCM'),
'docman' => _('Documentation Manager'),
+ )
) ;
+
+ plugin_hook ("role_translate_strings") ;
}
setup_rbac_strings () ;
$this->hooks[] = "groupisactivecheckboxpost" ; //
$this->hooks[] = "project_public_area";
$this->hooks[] = "role_get";
+ $this->hooks[] = "role_translate_strings";
}
function CallHook ($hookname, $params) {
}
} elseif ($hookname == "role_get") {
$role =& $params['role'] ;
- $role->role_values['plugin_mediawiki_edit'] = array ('0', '1', '2') ;
- $defaults = array (
- 'Admin' => array ('plugin_mediawiki_edit' => '2'),
- 'Senior Developer' => array ('plugin_mediawiki_edit' => '2'),
- 'Junior Developer' => array ('plugin_mediawiki_edit' => '1'),
- 'Doc Writer' => array ('plugin_mediawiki_edit' => '2'),
- 'Support Tech' => array ('plugin_mediawiki_edit' => '0')
- ) ;
-
- $role->defaults = array_merge_recursive ($role->defaults,
- $defaults) ;
- }
+ $edit = new PluginSpecificRoleSetting ($role,
+ 'plugin_mediawiki_edit') ;
+ $edit->SetAllowedValues (array ('0', '1', '2')) ;
+ $edit->SetDefaultValues (array ('Admin' => '2',
+ 'Senior Developer' => '2',
+ 'Junior Developer' => '1',
+ 'Doc Writer' => '2',
+ 'Support Tech' => '0')) ;
+ } elseif ($hookname == "role_translate_strings") {
+ $edit = new PluginSpecificRoleSetting ($role,
+ 'plugin_mediawiki_edit') ;
+ $edit->setDescription (_('Mediawiki write access')) ;
+ $edit->setValueDescriptions (array ('0' => _('No editing'),
+ '1' => _('Edit existing pages only'),
+ '2' => _('Edit and create pages'))) ;
+ }
}
-}
+ }
// Local Variables:
// mode: php