You are here

function secure_permissions_rebuild in Secure Permissions 6

Same name and namespace in other branches
  1. 7.2 secure_permissions.module \secure_permissions_rebuild()
  2. 7 secure_permissions.module \secure_permissions_rebuild()

Rebuild permissions, based on presets from the API.

It is important to always call this function, instead of the individual build functions, since this rebuild call sanity-checks the module settings.

3 calls to secure_permissions_rebuild()
secure_permissions_drush_rebuild in includes/secure_permissions.drush.inc
Callback function for drush rebuild-perms.
secure_permissions_form_submit in ./secure_permissions.module
We cannot rebuild the menu baed on a setting during form submit, at least, not without special handling.
secure_permissions_modules_submit in ./secure_permissions.module
Rebuild permissions on module page submission.

File

./secure_permissions.module, line 130
Secure Permissions module file.

Code

function secure_permissions_rebuild() {

  // Killswitch for the module, to let admins export permissions before continuing.
  // If only one module responds, it is the core module and we cannot rebuild.
  $modules = module_implements('secure_permissions');
  if (!secure_permissions_variable('secure_permissions_active') || count($modules) < 2) {
    return;
  }
  $rebuild_roles = secure_permissions_build_roles();
  $rebuild_perms = secure_permissions_build_permissions();
  if (secure_permissions_variable('secure_permissions_verbose') && $rebuild_roles && $rebuild_perms) {
    drupal_set_message(t('Site roles and permissions have been rebuilt successfully.'), 'status', FALSE);
  }
}