Scalr\Acl\Acl::getFullAccessAccountRole PHP Method

getFullAccessAccountRole() public method

Gets full access account role
public getFullAccessAccountRole ( integer $accountId, boolean $createIfNotExist = false ) : Scalr\Acl\Role\AccountRoleObject
$accountId integer The identifier of the client's account
$createIfNotExist boolean optional If true it will create full access role when it does not exist.
return Scalr\Acl\Role\AccountRoleObject Returns AccountRoleObject
    public function getFullAccessAccountRole($accountId, $createIfNotExist = false)
    {
        $accountRoleId = $this->db->GetOne("\n            SELECT r.`account_role_id` `id`\n            FROM `acl_account_roles` r\n            WHERE r.`account_id` = ?\n            AND r.`role_id` = ?\n            AND r.`is_automatic` = 1\n            LIMIT 1\n        ", array($accountId, Acl::ROLE_ID_FULL_ACCESS));
        return !empty($accountRoleId) ? $this->getAccountRole($accountRoleId) : ($createIfNotExist ? $this->createFullAccessAccountRole($accountId) : null);
    }