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:
Sam Minnee 2009-10-15 22:35:45 +00:00
parent 08166d902a
commit fc8786ee4e

View File

@ -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'
);
}
}