silverstripe-module silverstripe-defaultgroups
Programmatically define default groups
titledk/silverstripe-defaultgroups
Programmatically define default groups
- Friday, March 31, 2017
- by titledk
- Repository
- 2 Watchers
- 0 Stars
- 37 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
Default Groups
Programmatically define default groups, (*1)
Can be added to a member extension like this:
class MemberExtension extends DataExtension {
const APP_ADMIN_GROUP_CODE = 'app-admins';
const APP_USER_GROUP_CODE = 'app-users';
public function requireDefaultRecords() {
parent::requireDefaultRecords();
DefaultGroupsHelper::default_group(
MemberExtension::APP_USER_GROUP_CODE, //group code
_t('MemberExtension.AppUsers','App Users'), //group name
null, //parent code
null //permissions
);
DefaultGroupsHelper::default_group(
MemberExtension::APP_ADMIN_GROUP_CODE, //group code
_t('MemberExtension.AppAdministrators','App Administrators'), //group name
MemberExtension::APP_USER_GROUP_CODE, // parent code
//permissions:
array(
'APP_ACCESS_ADMIN'
)
);
}
}