You are here

function secure_permissions_rebuild in Secure Permissions 7.2

Same name and namespace in other branches
  1. 6 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.

4 calls to secure_permissions_rebuild()
secure_permissions_drush_rebuild in ./secure_permissions.drush.inc
Callback function for drush secure-permissions-rebuild.
secure_permissions_form_submit in ./secure_permissions.module
We cannot rebuild the menu based on a setting during form submit, at least, not without special handling.
secure_permissions_modules_disabled in ./secure_permissions.module
Implements hook_modules_disabled().
secure_permissions_modules_enabled in ./secure_permissions.module
Implements hook_modules_enabled().

File

./secure_permissions.module, line 148
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);
  }
}