mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR implement new permission code around SiteConfig. (from r88869)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89198 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
08166d902a
commit
fc8786ee4e
@ -5,7 +5,7 @@
|
||||
*
|
||||
* @author Tom Rix
|
||||
*/
|
||||
class SiteConfig extends DataObject {
|
||||
class SiteConfig extends DataObject implements PermissionProvider {
|
||||
static $db = array(
|
||||
"Title" => "Varchar(255)",
|
||||
"Tagline" => "Varchar(255)",
|
||||
@ -53,7 +53,7 @@ class SiteConfig extends DataObject {
|
||||
$editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
|
||||
$editorsOptionsField->setSource($editorsOptionsSource);
|
||||
|
||||
if(!Permission::check('ADMIN')) {
|
||||
if (!Permission::check('ADMIN') && !Permission::check('EDIT_SITECONFIG')) {
|
||||
$fields->makeFieldReadonly($viewersOptionsField);
|
||||
$fields->makeFieldReadonly($viewerGroupsField);
|
||||
$fields->makeFieldReadonly($editorsOptionsField);
|
||||
@ -73,7 +73,7 @@ class SiteConfig extends DataObject {
|
||||
* @return Fieldset
|
||||
*/
|
||||
function getFormActions() {
|
||||
if(Permission::check('ADMIN')) {
|
||||
if (!Permission::check('ADMIN') && !Permission::check('EDIT_SITECONFIG')) {
|
||||
$actions = new FieldSet(
|
||||
new FormAction('save_siteconfig', 'Save')
|
||||
);
|
||||
@ -149,4 +149,10 @@ class SiteConfig extends DataObject {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function providePermissions() {
|
||||
return array(
|
||||
'EDIT_SITECONFIG' => 'Edit site config details, including top level page permissions'
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user