You are here

function content_access_save_permissions in Content Access 6

Same name and namespace in other branches
  1. 7 content_access.admin.inc \content_access_save_permissions()

Saves the given permissions by role to the database.

2 calls to content_access_save_permissions()
content_access_admin_settings_submit in ./content_access.admin.inc
content_access_update_6001 in ./content_access.install
Upgrade from d5 to d6

File

./content_access.admin.inc, line 225
Content access administration UI.

Code

function content_access_save_permissions($permissions) {
  foreach ($permissions as $rid => $perms) {
    $perms = array_filter($perms);
    db_query('DELETE FROM {permission} WHERE rid = %d', $rid);
    if (count($perms)) {
      db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $rid, implode(', ', array_keys($perms)));
    }
  }

  // Make sure new permissions are applied immediately.
  content_access_get_permission_access(FALSE, TRUE);
}