You are here

function config_perms_save in Custom Permissions 7.2

Same name and namespace in other branches
  1. 6.2 config_perms.module \config_perms_save()

Inserts or updates a perm into the database.

Parameters

$preset: The perm object to be inserted.

3 calls to config_perms_save()
config_perms_admin_form_submit in ./config_perms.admin.inc
Submit handler.
config_perms_update_7201 in ./config_perms.install
Fix permissions that were incorrectly stored with escaped HTML characters.
config_perms_update_7202 in ./config_perms.install
Add the administer account settings permission.

File

./config_perms.module, line 169
Allows additional permissions to be created and managed through a administration form

Code

function config_perms_save($perm) {
  $perm = (object) $perm;

  // Generate machine name
  $perm->machine_name = config_perms_generate_machine_name($perm->name);
  if (isset($perm->pid)) {
    drupal_write_record('config_perms', $perm, 'pid');
  }
  else {
    drupal_write_record('config_perms', $perm);
  }
  return $perm;
}