MINOR create the ability to have some roles only be able to be applied by admins (from r88090)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89180 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-10-15 22:23:39 +00:00
parent e9ff3f3711
commit 0c41f681b8

View File

@ -101,19 +101,19 @@ class Group extends DataObject {
$fields->removeFieldFromTab('Root', 'IP Addresses'); $fields->removeFieldFromTab('Root', 'IP Addresses');
} }
if(Permission::check('EDIT_PERMISSIONS') && DataObject::get('PermissionRole')) { if(Permission::check('APPLY_ROLES') && DataObject::get('PermissionRole')) {
$fields->addFieldToTab(_t('SecurityAdmin.ROLES', 'Roles'), $fields->addFieldToTab('Root.' . _t('SecurityAdmin.ROLES', 'Roles'),
new LiteralField( new LiteralField(
"", "",
"<p>" . "<p>" .
_t('SecurityAdmin.ROLESDESCRIPTION', _t('SecurityAdmin.ROLESDESCRIPTION',
"This section allows you to add roles to this group. Roles are logical groupings of permissions, which can be editied in the Roles tab" "This section allows you to add roles to this group. Roles are logical groupings of permissions, which can be editied in the Roles tab"
) . ) .
"</p>" "</p>"
) )
); );
$roleData = Permission::check('ADMIN') ? DataObject::get('PermissionRole') : DataObject::get('PermissionRole', 'OnlyAdminCanApply = 0');
$fields->addFieldToTab(_t('SecurityAdmin.ROLES', 'Roles'), new CheckboxSetField('Roles', 'Roles', DataObject::get('PermissionRole'))); $fields->addFieldToTab('Root.' . _t('SecurityAdmin.ROLES', 'Roles'), new CheckboxSetField('Roles', 'Roles', $roleData));
} }
$memberList->setController($this); $memberList->setController($this);