Scalr\Acl\Acl::getAccountRole PHP Method

getAccountRole() public method

Gets role of account level
public getAccountRole ( string $accountRoleId, integer $accountId = null ) : Scalr\Acl\Role\AccountRoleObject
$accountRoleId string The ID of the account role
$accountId integer optional Restricts result by identifier of the account
return Scalr\Acl\Role\AccountRoleObject Returns AccountRoleObject for the specified ID of account role. It returns null if object does not exist.
    public function getAccountRole($accountRoleId, $accountId = null)
    {
        $rec = $this->db->GetRow("\n            SELECT `account_role_id`, `account_id`, `role_id`, `name`, `color`, `is_automatic`\n            FROM `acl_account_roles`\n            WHERE `account_role_id` = ?\n            " . (!empty($accountId) ? " AND `account_id` = " . intval($accountId) : "") . "\n            LIMIT 1\n        ", array($accountRoleId));
        if ($rec !== false) {
            $role = $this->getAccountRoleByRow($rec);
        }
        return isset($role) ? $role : null;
    }