class Role7

  1. 8.0.x lib/Drush/Role/Role7.php Role7
  2. 7.x lib/Drush/Role/Role7.php Role7
  3. master lib/Drush/Role/Role7.php Role7

Namespace

Drush\Role

Hierarchy

Expanded class hierarchy of Role7

Members

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

File

lib/Drush/Role/Role7.php, line 5

View source
class Role7 extends RoleBase {
  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);
  }
}