Skip to content

Instantly share code, notes, and snippets.

@paulwsmith
Last active August 29, 2015 13:57
Show Gist options
  • Save paulwsmith/9749872 to your computer and use it in GitHub Desktop.
Save paulwsmith/9749872 to your computer and use it in GitHub Desktop.
<?php
function beforeSave() {
$current_role_id; // = something... role that was set to false
foreach($data['read'] as $role_id => $value) {
if ($value == false) {
$record_permission_data = $this->RecordPermission->find(array(
'conditions' => array(
'scope' => $this->data['scope'] . '.Records'
)
));
foreach ($record_permission_data as $crud => $role_data) {
$record_permission[$crud][$current_role_id] = false;
}
$this->RecordPermission->save($record_permission_data);
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment