Initialize from a role string.

@param string $role_name Role name in URI format
@param GeneralNames|null $authority Issuing authority
@return self
767239
public static function fromString(string $role_name,
        GeneralNames $authority = null): self
    {
        return new self(new UniformResourceIdentifier($role_name), $authority);
    }
939541
function assign($Role, $UserID = null)
	{
	    if ($UserID === null)
		    throw new \RbacUserNotProvidedException ("\$UserID is a required argument.");

		if (is_numeric($Role))
		{
			$RoleID = $Role;
		} else {
			if (substr($Role, 0, 1) == "/")
				$RoleID = Jf::$Rbac->Roles->pathId($Role);
			else
				$RoleID = Jf::$Rbac->Roles->titleId($Role);
		}

		$res = Jf::sql ( "INSERT INTO {$this->tablePrefix()}userroles
				(UserID,RoleID,AssignmentDate)
				VALUES (?,?,?)
				", $UserID, $RoleID, Jf::time () );
		return $res >= 1;
	}
494046
function auto_create_parent($access_name) {
        $path = str_replace('.', '._items.', $access_name);
        $arr = explode('.', $access_name);
        $tmp = array_pop($arr);
        $default_title = ucwords(str_replace('_', ' ', $tmp));
        if (!Arr::path($this->items, $path . '.item')) {
            Arr::set_path($this->items, $path . '.item.text', $default_title);
            Arr::set_path($this->items, $path . '.item.url', '#');
        }
        if (!Arr::path($this->items, $path . '.access_name')) {
            Arr::set_path($this->items, $path . '.access_name', $access_name);
        }
    }
974588
protected function updateRole($role_id)
    {
        if (!$this->isError() && !$this->role->update($role_id, $this->getSubmitted())) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
120161
public function getRole($roleName, $organization = null)
    {
        $url = self::makeUrl($organization, $roleName);
        $resp = $this->service->prepAndSend($url, array(200), 'GET', null, true, 'application/json', 'application/json');	
		$data = json_decode($resp);
        return @new Role($data->name, $data->tenantId, $data->externallyDefined);
    }
422826
public function inherits(string ...$roles)
    {
        foreach ($roles as $role)
        {
            if (!$this->roleRegistry->exists($role)) {
                throw new \Exception(
                    sprintf(
                        "The role: %s doesnt exist",
                        (string)$role
                    )
                );
            }

            $this->roleRegistry->setRegistryValue($this->session["role"], $role);
        }

        $this->initSession();
    }
423475
def create_role(resource_root,
                service_name,
                role_type,
                role_name,
                host_id,
                cluster_name="default"):
  
  apirole = ApiRole(resource_root, role_name, role_type,
                    ApiHostRef(resource_root, host_id))
  return call(resource_root.post,
      _get_roles_path(cluster_name, service_name),
      ApiRole, True, data=[apirole])[0]
1301745
def set_role_id(name, role_id)
      options = { role_id: role_id }
      client.post("/v1/auth/approle/role/#{encode_path(name)}/role-id", JSON.fast_generate(options))
      return true
    end
245602
protected function createRole($name)
    {
        $role = RoleProxy::create(['name' => $name])->fresh();

        $role->givePermissionTo(ResourcePermissions::allPermissionsFor('user'));
        $role->givePermissionTo(ResourcePermissions::allPermissionsFor('role'));

        return $role;
    }
1280929
public function setAuthorName(string $author_name): self
    {
        return $this->setAuthor($author_name, $this->author_link, $this->author_icon);
    }
260335
public function createRole(RoleAssignment $roleAssignment): UIValue\User\Role
    {
        return new UIValue\User\Role($roleAssignment);
    }
1000027
public function loadRoleAssignment($roleAssignmentId)
    {
        $query = $this->handler->createSelectQuery();
        $query->select(
            $this->handler->quoteColumn('id'),
            $this->handler->quoteColumn('contentobject_id'),
            $this->handler->quoteColumn('limit_identifier'),
            $this->handler->quoteColumn('limit_value'),
            $this->handler->quoteColumn('role_id')
        )->from(
            $this->handler->quoteTable('ezuser_role')
        )->where(
            $query->expr->eq(
                $this->handler->quoteColumn('id'),
                $query->bindValue($roleAssignmentId, null, \PDO::PARAM_INT)
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
998402
protected function initSURole() : void
    {
        $this->stdout("Init SU role \n",  Console::FG_YELLOW);
        $this->authManager->removeAll();
        $su = $this->authManager->createRole(Rbac::R_SU);
        $su->description = 'Super User';
        $this->authManager->add($su);
    }
1012668
private function createRoles(Permission $permission): void
	{
		/* @var $role AclRole */
		foreach ($this->orm->aclRoles->findSorted() as $role) {
			$parent = null;
			if ($role->parent) {
				$parent = $role->parent->name;
			}
			$permission->addRole($role->name, $parent);
		}
	}
359069
protected function getAuthority()
    {
        if (is_null($this->authority)) {
            return null;
        }

        if ($this->authority instanceof Model) {
            return $this->authority;
        }

        return Models::role()->firstOrCreate(['name' => $this->authority]);
    }
1016946
public function retrieveEmployeeRole($role_id)
    {
        list($response, $statusCode, $httpHeader) = $this->retrieveEmployeeRoleWithHttpInfo ($role_id);
        return $response; 
    }
491643
public static Role get(final String _name)
        throws CacheReloadException
    {
        final Cache<String, Role> cache = InfinispanCache.get().<String, Role>getCache(Role.NAMECACHE);
        if (!cache.containsKey(_name) && !Role.getRoleFromDB(Role.SQL_NAME, _name)) {
            cache.put(_name, Role.NULL, 100, TimeUnit.SECONDS);
        }
        final Role ret = cache.get(_name);
        return ret.equals(Role.NULL) ? null : ret;
    }