check role
@access protected
@return boolean
@since 3.0
@package Gcs\Framework\Core\Security
330039
protected function _checkRole() {
        if (in_array($this->_role, array_map('trim', explode(',', $this->request->access))) || $this->request->access == '*') {
            return true;
        }
        else {
            return false;
        }
    }
1023968
public function hasRole($requestedRole) {
		$roles = $this->user($this->getConfig('roleField'));
		if (is_null($roles)) {
			return false;
		}

		return $this->_checkRoles($requestedRole, $roles);
	}
593926
protected function validatePermissionsUserRole()
    {
        $field = 'permissions';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        if (empty($value)) {
            $this->setSubmitted($field, array());
            return null;
        }

        if (!is_array($value)) {
            $this->setErrorInvalid($field, $this->translation->text('Permissions'));
            return false;
        }

        $permissions = $this->role->getPermissions();
        $invalid = array_diff($value, array_keys($permissions));

        if (!empty($invalid)) {
            $this->setErrorUnavailable($field, implode(',', $invalid));
            return false;
        }

        return true;
    }
229756
public function hasRole($role)
    {
        $role = strtoupper($role);

        if ($role == 'ROLE_USER') {
            return true;
        }

        if (in_array($role, $this->roles)) {
            return true;
        }

        return false;
    }
22051
protected function getRole($role)
	{
		if (!isset($this->user))
			return false;

		if (isset($this->user->role))
			return $this->user->role->hasPermission($role);

		return false;
	}
1290240
public function hasRole($role)
    {
        $roles = $this->roles;
        foreach ($roles as $role_obj)
            if ($this->checkRole($role, $role_obj))
                return true;

        return false;
    }
534000
public function isRoleAllowed($role, $attribute = 'access')
    {
        if (is_array($role)) {
            foreach ($role as $r) {
                if ($this->isRoleAllowed($r, $attribute)) {
                    return true;
                }
            }
            return false;
        } else {
            $roleStr = (string) $role;
            $attrStr = (string) $attribute;
            if (isset($this->allowedRoles[$roleStr])) {
                return
                    (isset($this->allowedRoles[$roleStr][$attrStr]) ?
                    $this->allowedRoles[$roleStr][$attrStr] : false) ||
                    (isset($this->allowedRoles[$roleStr]['any']) ?
                    $this->allowedRoles[$roleStr]['any'] : false);
            }
            return false;
        }
    }
1259809
public static function check() {
		if (R::count("user") < 1) {
			$pwdbname             = setup::getValidation("password");
			$userdbname           = setup::getValidation("username");
			$guest                = R::dispense("user");
			$guest->{$userdbname} = "guest";
			$guest->{$pwdbname}   = "";
			$guest->role          = role::get("guest");
			R::store($guest);
		}
	}
159390
public function hasRole($role): bool
    {
        $slug = str_slug($role);

        return (bool) $this->roles->where('slug', $slug)->count();
    }
1006105
public function getIsAdmin()
	{
		if(!\Yii::$app->user->isGuest)
		{
			if(\Yii::$app->user->identity->role < 2)
			{
				return true;
			}
		}
		return false;
	}
905214
public function hasRole($role)
    {
        if ($this->user() === null) {
            return null;
        }

        return in_array($role, $this->roles, true);
    }
811494
protected function validateEditUserRole()
    {
        $this->setSubmitted('role');
        $this->setSubmittedBool('status');
        $this->setSubmitted('update', $this->data_role);

        if (!$this->getSubmitted('permissions')) {
            $this->setSubmitted('permissions', array());
        }

        $this->validateComponent('user_role');

        return !$this->hasErrors();
    }
150064
public function isAuthenticatedByRole(Role $role) {

		return !isset($this->auth) || $this->auth === $role->getRoleName();

	}
307807
public function isUserAllowedAccess()
    {
        if (!is_object($this->accessControl)) {
            $this->accessControl = new AccessControl($this->user, $this->config->get('AccessControl', false));
        }

        $isAccessAllowed = $this->accessControl->isUserAllowedAccess();
        if (!$isAccessAllowed) {
            $this->eventManager()->fire(SecurityEvent::ROLE_INVALID, new SecurityEvent($this->user));
        }

        return $isAccessAllowed;
    }
1261745
public function isUserAllowedAccess()
    {
        $requestedRoles = $this->getRequestedRoles();

        // we allow access if there are no requested roles that the user must have
        if (count($requestedRoles) < 1) {
            return true;
        }

        return $this->getAccessDecision($requestedRoles);
    }
846644
protected function checkPermission($permission = 'manage', $role = 'admin')
    {
        if ($this->auth->guest()) {
            return 401;
        }

        if ($this->auth->user()->can($permission) || $this->auth->user()->hasRole($role)) {
            return true;
        }

        return 403;
    }
1190327
public function hasRole($role)
    {
        return is_null($this->roles) || in_array($role, $this->roles, true);
    }