function access_grant_delete_confirm_submit in Access Control Kit 7
Form submission handler for access_grant_delete_confirm().
File
- ./
access_grants.admin.inc, line 716 - Access grants administrative UI for the access control kit module.
Code
function access_grant_delete_confirm_submit($form, &$form_state) {
$grant = $form_state['grant'];
$account = user_load($grant->uid);
$role = user_role_load($grant->rid);
$scheme = access_scheme_machine_name_load($grant->scheme);
// Delete the grant.
access_grant_delete($grant->gid);
// Report the change.
$t_args = array(
'%user' => format_username($account),
'%role' => $role->name,
'%scheme' => $scheme->name,
);
drupal_set_message(t("Deleted %scheme for %user's access as %role.", $t_args));
watchdog('access', "Deleted %scheme for %user as %role.", $t_args, WATCHDOG_NOTICE);
// Revoke the role entirely, if that option was selected.
if (!empty($form_state['values']['revoke_role'])) {
$roles = array_diff($account->roles, array(
$role->rid => $role->name,
));
$account->original = clone $account;
user_save($account, array(
'roles' => $roles,
));
}
$form_state['redirect'] = 'admin/access';
}