- /**
- * Check if the provided scope does exist
- *
- * @param string $scope the requested scope (read, write, follow, push)
- *
- * @return bool "true" if the scope is allowed
- */
- public static function isAllowedScope(string $scope)
- {
- $token = self::getCurrentApplicationToken();
-
- if (empty($token)) {
- Logger::notice('Empty application token');
- return false;
- }
-
- if (!isset($token[$scope])) {
- Logger::warning('The requested scope does not exist', ['scope' => $scope, 'application' => $token]);
- return false;
- }
-
- if (empty($token[$scope])) {
- Logger::warning('The requested scope is not allowed', ['scope' => $scope, 'application' => $token]);
- return false;
- }
-
- return true;
- }
-