class DrushRole7

Hierarchy

Expanded class hierarchy of DrushRole7

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
DrushRole7::delete public function Overrides DrushRole::delete
DrushRole7::getModulePerms public function Overrides DrushRole::getModulePerms
DrushRole7::getPerms public function Overrides DrushRole::getPerms
DrushRole7::grant_permissions public function Overrides DrushRole::grant_permissions
DrushRole7::revoke_permissions public function Overrides DrushRole::revoke_permissions
DrushRole7::role_create public function Overrides DrushRole::role_create
DrushRole::$name public property Drupal 6 and Drupal 7: 'rid' is numeric 'name' is machine name (e.g. 'anonymous user')
DrushRole::$rid public property
DrushRole::$roles public property This is initialized to the result of the user_roles() function, which returns an associative array of rid => name pairs.
DrushRole::add public function
DrushRole::getAllModulePerms public function
DrushRole::remove public function
DrushRole::__construct public function This constructor will allow the role to be selected either via the role id or via the role name.

File

classes/DrushRole.php, line 167

View source
class DrushRole7 extends DrushRole {
  public function getPerms() {
    $perms = user_role_permissions(array($this->rid => $this->name));
    return array_keys($perms[$this->rid]);
  }

  public function getModulePerms($module) {
    $perms = module_invoke($module, 'permission');
    return $perms ? array_keys($perms) : array();
  }

  public function role_create($role_machine_name, $role_human_readable_name = '') {
    return user_role_save((object) array('name' => $role_machine_name));
  }

  public function delete() {
    user_role_delete($this->rid);
  }

  public function grant_permissions($perms) {
    return drush_op('user_role_grant_permissions', $this->rid, $perms);
  }

  public function revoke_permissions($perms) {
    return drush_op('user_role_revoke_permissions', $this->rid, $perms);
  }
}