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() { function providePermissions() {
return array( 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() { function providePermissions() {
return array( return array(
'SITETREE_GRANT_ACCESS' => _t( 'SITETREE_GRANT_ACCESS' => array(
'SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION', 'name' => _t('SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION', 'Manage access rights for content'),
'Manage access rights for content' 'category' => 'Roles and access permissions',
'sort' => 100
), ),
'SITETREE_VIEW_ALL' => _t( 'SITETREE_VIEW_ALL' => array(
'SiteTree.VIEW_ALL_DESCRIPTION', 'name' => _t('SiteTree.VIEW_ALL_DESCRIPTION', 'View any page'),
'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' => array(
'SiteTree.EDIT_ALL_DESCRIPTION', 'name' => _t('SiteTree.EDIT_ALL_DESCRIPTION', 'Edit any page'),
'Edit any page' 'category' => 'Content permissions',
), 'sort' => -50,
'SITETREE_REORGANISE' => _t( 'help' => 'Ability to edit any page on the site, regardless of the settings on the Access tab. Requires "Access to Site Content."'
'SiteTree.REORGANISE_DESCRIPTION',
'Change site structure'
), ),
'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; // : $blankItemText;
// } // }
$allCodes['Other']['ADMIN'] = array( $allCodes['Roles and access permissions']['ADMIN'] = array(
'name' => _t('Permission.FULLADMINRIGHTS', 'Full administrative rights'), 'name' => _t('Permission.FULLADMINRIGHTS', 'Full administrative rights'),
'help' => null, 'help' => null,
'sort' => 0 'sort' => 100000
); );
if($classes) foreach($classes as $class) { if($classes) foreach($classes as $class) {
@ -523,11 +523,17 @@ class Permission extends DataObject {
} }
} }
$otherPerms = DB::query("SELECT DISTINCT \"Code\" From \"Permission\"") $flatCodeArray = array();
->column(); 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($otherPerms) foreach($otherPerms as $otherPerm) {
if(!array_key_exists($otherPerm, $allCodes['Other'])) if(!in_array($otherPerm, $flatCodeArray))
$allCodes['Other'][$otherPerm] = $otherPerm; $allCodes['Other'][$otherPerm] = array(
'name' => $otherPerm,
'help' => null,
'sort' => 0
);
} }
ksort($allCodes); ksort($allCodes);

View File

@ -46,8 +46,10 @@ class PermissionCheckboxSetField extends CheckboxSetField {
$checked = in_array($key, $values) ? ' checked="checked"' : ''; $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";
} }
} }
} }