diff --git a/src/Id/Enums/Scope.php b/src/Id/Enums/Scope.php index 0ce17a2..1a2c35a 100644 --- a/src/Id/Enums/Scope.php +++ b/src/Id/Enums/Scope.php @@ -33,6 +33,12 @@ class Scope const TRANSACTIONS_READ = 'transactions:read'; const TRANSACTIONS_CLIENT = 'transactions:client'; + // The user's own shared preferences (`global`). PREFERENCES_CLIENT labels an app token for + // the preferences of any user; access to a namespace is granted by Anikeen, not by the scope. + const PREFERENCES = 'preferences'; + const PREFERENCES_READ = 'preferences:read'; + const PREFERENCES_CLIENT = 'preferences:client'; + const SSH_KEYS = 'ssh-keys'; const SSH_KEYS_READ = 'ssh-keys:read'; diff --git a/tests/Id/ScopeTest.php b/tests/Id/ScopeTest.php index 08b3642..8273452 100644 --- a/tests/Id/ScopeTest.php +++ b/tests/Id/ScopeTest.php @@ -25,6 +25,13 @@ class ScopeTest extends TestCase $this->assertSame($expected, $constant); } + public function test_the_preference_scopes_match_anikeen_id(): void + { + $this->assertSame('preferences', Scope::PREFERENCES); + $this->assertSame('preferences:read', Scope::PREFERENCES_READ); + $this->assertSame('preferences:client', Scope::PREFERENCES_CLIENT); + } + public function test_there_is_no_full_products_scope_the_console_would_not_accept(): void { // the Console's product APIs accept `user`, `user:read` and `products:read` only