MINOR shuffled permissions around, gave them help text and categorized them.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90371 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Tom Rix 2009-10-29 00:55:20 +00:00
parent 643be30e67
commit 9c5dae4dff
4 changed files with 40 additions and 21 deletions

View File

@ -154,7 +154,12 @@ class SiteConfig extends DataObject implements PermissionProvider {
function providePermissions() {
return array(
'EDIT_SITECONFIG' => 'Manage site configuration'
'EDIT_SITECONFIG' => array(
'name' => 'Manage site configuration',
'category' => 'Roles and access permissions',
'help' => 'Ability to edit global access settings/top-level page permissions.',
'sort' => 400
)
);
}
}

View File

@ -2331,22 +2331,28 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
function providePermissions() {
return array(
'SITETREE_GRANT_ACCESS' => _t(
'SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION',
'Manage access rights for content'
'SITETREE_GRANT_ACCESS' => array(
'name' => _t('SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION', 'Manage access rights for content'),
'category' => 'Roles and access permissions',
'sort' => 100
),
'SITETREE_VIEW_ALL' => _t(
'SiteTree.VIEW_ALL_DESCRIPTION',
'View any page'
'SITETREE_VIEW_ALL' => array(
'name' => _t('SiteTree.VIEW_ALL_DESCRIPTION', 'View any page'),
'category' => 'Content permissions',
'sort' => -100,
'help' => 'Ability to view any page on the site, regardless of the settings on the Access tab. Requires "Access to Site Content."'
),
'SITETREE_EDIT_ALL' => _t(
'SiteTree.EDIT_ALL_DESCRIPTION',
'Edit any page'
),
'SITETREE_REORGANISE' => _t(
'SiteTree.REORGANISE_DESCRIPTION',
'Change site structure'
'SITETREE_EDIT_ALL' => array(
'name' => _t('SiteTree.EDIT_ALL_DESCRIPTION', 'Edit any page'),
'category' => 'Content permissions',
'sort' => -50,
'help' => 'Ability to edit any page on the site, regardless of the settings on the Access tab. Requires "Access to Site Content."'
),
'SITETREE_REORGANISE' => array(
'name' => _t('SiteTree.REORGANISE_DESCRIPTION', 'Change site structure'),
'category' => 'Content permissions',
'sort' => 100
)
);
}

View File

@ -486,10 +486,10 @@ class Permission extends DataObject {
// : $blankItemText;
// }
$allCodes['Other']['ADMIN'] = array(
$allCodes['Roles and access permissions']['ADMIN'] = array(
'name' => _t('Permission.FULLADMINRIGHTS', 'Full administrative rights'),
'help' => null,
'sort' => 0
'sort' => 100000
);
if($classes) foreach($classes as $class) {
@ -523,11 +523,17 @@ class Permission extends DataObject {
}
}
$otherPerms = DB::query("SELECT DISTINCT \"Code\" From \"Permission\"")
->column();
$flatCodeArray = array();
foreach($allCodes as $category) foreach($category as $code => $permission) $flatCodeArray[] = $code;
$otherPerms = DB::query("SELECT DISTINCT \"Code\" From \"Permission\"")->column();
if($otherPerms) foreach($otherPerms as $otherPerm) {
if(!array_key_exists($otherPerm, $allCodes['Other']))
$allCodes['Other'][$otherPerm] = $otherPerm;
if(!in_array($otherPerm, $flatCodeArray))
$allCodes['Other'][$otherPerm] = array(
'name' => $otherPerm,
'help' => null,
'sort' => 0
);
}
ksort($allCodes);

View File

@ -46,8 +46,10 @@ class PermissionCheckboxSetField extends CheckboxSetField {
$checked = in_array($key, $values) ? ' checked="checked"' : '';
$title = $permission['help'] ? 'title="'.htmlentities($permission['help']).'" ' : '';
$options .= "<li class=\"$extraClass\"><input id=\"$itemID\" name=\"$this->name[$key]\" type=\"checkbox\" value=\"$key\"$checked class=\"checkbox\" /> <label for=\"$itemID\">$value</label></li>\n";
$options .= "<li class=\"$extraClass\"><input id=\"$itemID\" name=\"$this->name[$key]\" type=\"checkbox\" value=\"$key\"$checked class=\"checkbox\" /> <label {$title}for=\"$itemID\">$value</label></li>\n";
}
}
}