You are here

function hook_access_grant_update in Access Control Kit 7

Responds to updates to an access grant.

This hook is invoked from AccessGrantEntityController::save() after the database query that will update the grant in the access_grant table is scheduled for execution and field_attach_update() is called.

Note that when this hook is invoked, the changes have not yet been written to the database because a database transaction is still in progress. The transaction is not finalized until the save operation is entirely completed and the save() method goes out of scope. You should not rely on data in the database at this time, as it has not been updated yet. You should also note that any write/update database queries executed from this hook are also not committed immediately. Check AccessGrantEntityController::save() and db_transaction() for more info.

Parameters

object $grant: The access grant that is being updated.

File

./access.api.php, line 442
Hooks provided by the access control kit module.

Code

function hook_access_grant_update($grant) {

  // Notify the user whenever an access grant changes for user 1.
  if ($grant->uid == 1) {
    drupal_set_message(t('An access grant has changed for the site administrator.'));
  }
}