mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Added providePermissions for SUBSITE_EDIT
Updated domain field editing
This commit is contained in:
parent
5aff60efb5
commit
fa54508d5e
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* A dynamically created subdomain. SiteTree objects can now belong to a subdomain
|
||||
*/
|
||||
class Subsite extends DataObject {
|
||||
class Subsite extends DataObject implements PermissionProvider {
|
||||
|
||||
static $default_sort = 'Title';
|
||||
|
||||
@ -27,6 +27,9 @@ class Subsite extends DataObject {
|
||||
|
||||
static $cached_subsite = null;
|
||||
|
||||
public static $allowed_domains = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Return the base domain for this set of subsites.
|
||||
* You can set this by setting Subsite::$Base_domain, otherwise it defaults to HTTP_HOST
|
||||
@ -63,7 +66,10 @@ class Subsite extends DataObject {
|
||||
new Tab('Configuration',
|
||||
new HeaderField($this->getClassName() . ' configuration', 2),
|
||||
new TextField('Title', 'Name of subsite:', $this->Title),
|
||||
$this->domainField(),
|
||||
new FieldGroup('URL',
|
||||
new TextField('Subdomain',"", $this->Subdomain),
|
||||
new DropdownField('Domain','.', $this->stat('allowed_domains'), $this->Domain)
|
||||
),
|
||||
// new TextField('RedirectURL', 'Redirect to URL', $this->RedirectURL),
|
||||
new CheckboxField('DefaultSite', 'Use this subsite as the default site', $this->DefaultSite),
|
||||
new CheckboxField('IsPublic', 'Can access this subsite publicly?', $this->IsPublic)
|
||||
@ -80,20 +86,12 @@ class Subsite extends DataObject {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function domainField() {
|
||||
return new FieldGroup('Subsite domain',
|
||||
new TextField('Subdomain',"", $this->Subdomain),
|
||||
new TextField('Domain','.', $this->Domain)
|
||||
);
|
||||
}
|
||||
|
||||
function getClassName() {
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
function getCMSActions() {
|
||||
return new FieldSet(
|
||||
new FormAction('savesubsite', 'Save')
|
||||
);
|
||||
}
|
||||
|
||||
@ -241,6 +239,11 @@ SQL;
|
||||
);
|
||||
}
|
||||
|
||||
function providePermissions() {
|
||||
return array(
|
||||
'SUBSITE_EDIT' => 'Edit Sub-site Details',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user