mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merged revisions 51659 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r51659 | ischommer | 2008-03-26 15:43:01 +1300 (Wed, 26 Mar 2008) | 1 line ENHANCEMENT Moved Group field generation from SecurityAdmin->getEditForm() to Group->getCMSFields() ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52414 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f7aa3ac61a
commit
b38c0d0941
@ -34,6 +34,65 @@ class Group extends DataObject {
|
|||||||
"Hierarchy",
|
"Hierarchy",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Caution: Only call on instances, not through a singleton.
|
||||||
|
*
|
||||||
|
* @return FieldSet
|
||||||
|
*/
|
||||||
|
public function getCMSFields() {
|
||||||
|
$fields = new FieldSet(
|
||||||
|
new TabSet("Root",
|
||||||
|
new Tab(_t('SecurityAdmin.MEMBERS', 'Members'),
|
||||||
|
new TextField("Title", _t('SecurityAdmin.GROUPNAME', 'Group name')),
|
||||||
|
$memberList = new MemberTableField(
|
||||||
|
$this,
|
||||||
|
"Members",
|
||||||
|
$record,
|
||||||
|
null,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
new Tab(_t('SecurityAdmin.PERMISSIONS', 'Permissions'),
|
||||||
|
new LiteralField(
|
||||||
|
"",
|
||||||
|
"<p>" .
|
||||||
|
_t('SecurityAdmin.ADVANCEDONLY',
|
||||||
|
"This section is for advanced users only.
|
||||||
|
See <a href=\"http://doc.silverstripe.com/doku.php?id=permissions:codes\" target=\"_blank\">this page</a>
|
||||||
|
for more information."
|
||||||
|
) .
|
||||||
|
"</p>"
|
||||||
|
),
|
||||||
|
new TableField(
|
||||||
|
"Permissions",
|
||||||
|
"Permission",
|
||||||
|
array(
|
||||||
|
"Code" => _t('SecurityAdmin.CODE', 'Code'),
|
||||||
|
"Arg" => _t('SecurityAdmin.OPTIONALID', 'Optional ID'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
"Code" => "PermissionDropdownField",
|
||||||
|
"Arg" => "TextField",
|
||||||
|
),
|
||||||
|
"GroupID", $id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!Permission::check('EDIT_PERMISSIONS')) $fields->removeFieldFromTab('Root', 'Permissions');
|
||||||
|
|
||||||
|
$memberList->setController($this);
|
||||||
|
$memberList->setPermissions(array('show', 'edit', 'delete', 'export', 'add'));
|
||||||
|
$memberList->setParentClass('Group');
|
||||||
|
$memberList->setPopupCaption(_t('SecurityAdmin.VIEWUSER', 'View User'));
|
||||||
|
|
||||||
|
$fields->push($idField = new HiddenField("ID"));
|
||||||
|
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
static function getAdminGroups() {
|
static function getAdminGroups() {
|
||||||
return DataObject::get('Group',"CanCMSAdmin=1");
|
return DataObject::get('Group',"CanCMSAdmin=1");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user