Returns true if the given role or role of the current user has the given privilege

@param string $privilege
@param string $role
@return bool
@deprecated Since 1.7.2 Replaced by $this->currentUser->hasPrivilege();
357922
public function hasPrivilege($privilege, $role = null)
    {
        if (is_null($role)) $role = $this->session->user_role;
        return (! $this->acl) || $this->acl->isAllowed($role, null, $privilege);
    }
235206
public function grantToRole($permission, $role)
    {
        /** @var EloquentRole $roleModel */
        if ( ! ($roleModel = $this->sentinel->findRoleBySlug($role))) {
            return false;
        }

        $permissions = is_array($permission) ? $permission : [ $permission ];

        foreach ($permissions as $singlePermission) {
            $this->grantSinglePermissionToRole($singlePermission, $roleModel);
        }

        if ( ! $roleModel->save()) {
            // @codeCoverageIgnoreStart
            return false;
            // @codeCoverageIgnoreEnd
        }

        $this->fireRoleChangeEvent();
        return true;
    }
1015011
public function hasRoleWithName(string $role): bool
    {
        $this->compileUserRoles();

        return in_array($role, $this->userRoles);
    }
1287186
public function hasRole(string $role): bool
    {
        return (null !== $this->roles) ? \in_array($role, $this->roles) : false;
    }
839940
public function getRolesByPrivilege($privilege)
    {
        $roles = array();

        if ($this->acl) {
            foreach ($this->acl->getRoles() as $role) {
                if ($this->acl->isAllowed($role, null, $privilege)) {
                    //Do not translate, only make first one uppercase
                    $roles[$role] = ucfirst($role);
                }
            }
        }

        return $roles;
    }
1122280
public function hasRole(Role $role)
    {
        $role = !is_string($role) ?: Role::where(['name' => $role])->firstOrFail();

        if ($role) {
            foreach ($this->roles as $r) {
                if ($r->id == $role->id) {
                    return true;
                }
            }
        }

        return false;
    }
758347
private function hasRole($role) {

        if (substr($role, 0, 4) !== 'urn:')
        {
            $role = 'urn:lti:role:ims/lis/' . $role;
        }

        return in_array($role, $this->roles);

    }
395561
public function hasRole($roleName)
    {
        if (! is_null($this->getUser())) {
            return $this->getUser()->hasRole($roleName);
        }

        return false;
    }
327484
public function isAllowed( $resource, $privilege = self::PRIVILEGE_DEFAULT, $role = null )
    {
        if ( empty( $role ) )
        {
            $role = $this->getRole();
        }

        $role       = $this->checkRole( $role );
        $resource   = $this->checkResource( $resource );

        return $this->getAcl()
                    ->isAllowed( $role,
                                 $resource,
                                 $privilege ?: self::PRIVILEGE_DEFAULT );
    }
966964
public function hasRoles($roles)
    {
        if (! is_null($this->getUser())) {
            return $this->getUser()->hasRoles($roles);
        }

        return false;
    }
1287162
public function getPermission($role)
    {
        if ($role instanceof RoleInterface || $role instanceof \Symfony\Component\Security\Core\Role\Role) {
            $role = $role->getRole();
        }
        if (isset($this->permissions[$role])) {
            return $this->permissions[$role];
        }

        return null;
    }
102635
public function grantAccess($roleOrPermission, UserInterface $user = null)
    {
        $user = $user ? : $this->currentUser();

        if (is_array($roleOrPermission) && $this->grantAccessByRoles($roleOrPermission, $user)) {
            return true;
        } else if (is_array($roleOrPermission) && $this->grantAccessByPermissions($roleOrPermission, $user)) {
            return true;
        } else if ($this->grantAccessByRole($roleOrPermission, $user)) {
            return true;
        } else if ($this->grantAccessByPermission($roleOrPermission, $user)) {
            return true;
        }

        return false;
    }
905214
public function hasRole($role)
    {
        if ($this->user() === null) {
            return null;
        }

        return in_array($role, $this->roles, true);
    }
1063247
public function hasRole($role, $requireAll = false)
    {
        if ($user = $this->user()) {
            return $user->hasRole($role, $requireAll);
        }

        return false;
    }
107562
public function hasRole($role_name)
    {

        if ($this->hasSuperUser())
            return true;

        foreach ($this->group->roles as $role)
            if ($role->title == $role_name)
                return true;

        return false;

    }
123458
public function hasRole($role)
    {
        $roles = array_column($this->roles->toArray(), 'name');
        return array_search($role, $roles) > -1;
    }
177037
public function hasRoles($roles)
    {
        if ($this->user() === null) {
            return null;
        }

        if (!is_array($roles)) {
            $roles = func_get_args();
        }

        // Count roles because user need user to have all roles passed as parameter
        return count(array_intersect($roles, $this->roles)) === count($roles);
    }