2009-10-16 00:33:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Admin interface for Permission Roles.
|
|
|
|
*/
|
|
|
|
class PermissionRoleAdmin extends ModelAdmin {
|
|
|
|
static $managed_models = array(
|
|
|
|
'PermissionRole'
|
|
|
|
);
|
|
|
|
|
2010-01-19 02:01:46 +01:00
|
|
|
public static $collection_controller_class = "PermissionRoleAdmin_CollectionController";
|
|
|
|
public static $record_controller_class = "PermissionRoleAdmin_RecordController";
|
|
|
|
|
2009-10-16 00:33:09 +02:00
|
|
|
static $url_segment = 'roles';
|
|
|
|
static $menu_title = 'Roles';
|
|
|
|
}
|
|
|
|
|
2010-01-19 02:01:46 +01:00
|
|
|
/**
|
|
|
|
* Customized controller for hiding permissions on AddForm
|
|
|
|
*/
|
|
|
|
class PermissionRoleAdmin_CollectionController extends ModelAdmin_CollectionController {
|
|
|
|
public function AddForm() {
|
|
|
|
$form = parent::AddForm();
|
|
|
|
if ( $this->modelClass=='PermissionRole' ) {
|
|
|
|
$permissionField = $form->Fields()->dataFieldByName('Codes');
|
|
|
|
if($permissionField) $permissionField->setHiddenPermissions(SecurityAdmin::$hidden_permissions);
|
|
|
|
}
|
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Customized controller for hiding permissions on EditForm
|
|
|
|
*/
|
|
|
|
class PermissionRoleAdmin_RecordController extends ModelAdmin_RecordController {
|
|
|
|
public function EditForm() {
|
|
|
|
$form = parent::EditForm();
|
|
|
|
if ( $this->parentController->modelClass=='PermissionRole' ) {
|
|
|
|
$permissionField = $form->Fields()->dataFieldByName('Codes');
|
|
|
|
if($permissionField) $permissionField->setHiddenPermissions(SecurityAdmin::$hidden_permissions);
|
|
|
|
}
|
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-16 00:33:09 +02:00
|
|
|
?>
|