Guest User

Untitled

a guest
Jul 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. ===================================================================
  2. --- sapphire/security/PermissionCheckboxSetField.php (revision 94796)
  3. +++ sapphire/security/PermissionCheckboxSetField.php (working copy)
  4. @@ -122,7 +122,13 @@
  5. function saveInto(DataObject $record) {
  6. $fieldname = $this->name;
  7. $managedClass = $this->managedClass;
  8. - $record->$fieldname()->removeAll();
  9. +
  10. + // remove all permissions and re-add them afterwards
  11. + $permissions = $record->$fieldname();
  12. + foreach ( $permissions as $permission ) {
  13. + $permission->delete();
  14. + }
  15. +
  16. if($fieldname && $record && ($record->has_many($fieldname) || $record->many_many($fieldname))) {
  17. $idList = array();
  18. if($this->value) foreach($this->value as $id => $bool) {
Add Comment
Please, Sign In to add comment