Give trusted apps the user's role

Anikeen ID now sends trusted apps the user's role (admin or user) in
GET v1/user, a user read by ID and user.updated, so an app like the
Console can take its admins from Anikeen ID. Enums\Role, the Socialite
user's role and Resources\User::role()/isAdmin() expose it.
This commit is contained in:
envoyr committed 2026-11-07 15:24:48 +00:00
1 parent 31de31aa47
commit 642e518259
8 files changed
+154 -1

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Anikeen\Id\Enums;
/**
* A user's role on Anikeen ID. Only trusted apps see it: `role` of GET v1/user (the Socialite
* user), of a user read by ID and of user.updated; other apps get none.
*/
class Role
{
/** Runs Anikeen (the Anikeen ID admin panel). */
const ADMIN = 'admin';
const USER = 'user';
/**
* @return list<string>
*/
public static function all(): array
{
return [self::ADMIN, self::USER];
}
}