public static function hasAccessInCapabilities(string $capability, string $userId): bool
    {
        $userCaps = static::fetchUserCapabilities($userId);
        if (in_array($capability, $userCaps)) {
            return true;
        }

        return false;
    }
public static function hasAccessInCapabilities(string $capability, string $userId): bool
    {
        $userCaps = static::fetchUserCapabilities($userId);
        if (in_array($capability, $userCaps)) {
            return true;
        }

        return false;
    }
public static function hasAccessInCapabilities ( string $ capability , string $ userId ) : bool { $ userCaps = static :: fetchUserCapabilities ( $ userId ) ; if ( in_array ( $ capability , $ userCaps ) ) { return true ; } return false ; }
Method that checks if current user is allowed access.

Returns true if current user has access, false otherwise.

@param  string $capability capability name
@param  string $userId     user id
@return bool
Method that checks if current user is allowed access .