mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: adding onAfterDelete hooks to remove the no longer necessary permissions (from r94859)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@95627 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d8017fe459
commit
d459e17288
@ -336,6 +336,16 @@ class Group extends DataObject {
|
||||
}
|
||||
}
|
||||
|
||||
function onAfterDelete() {
|
||||
parent::onAfterDelete();
|
||||
|
||||
// Delete associated permissions
|
||||
$permissions = $this->Permissions();
|
||||
foreach ( $permissions as $permission ) {
|
||||
$permission->delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for permission-code CMS_ACCESS_SecurityAdmin.
|
||||
* If the group has ADMIN permissions, it requires the user to have ADMIN permissions as well.
|
||||
|
@ -36,4 +36,14 @@ class PermissionRole extends DataObject {
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function onAfterDelete() {
|
||||
parent::onAfterDelete();
|
||||
|
||||
// Delete associated permission codes
|
||||
$codes = $this->Codes();
|
||||
foreach ( $codes as $code ) {
|
||||
$code->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user