mirror of
https://github.com/anikeen-com/id.git
synced 2026-11-08 00:28:32 +00:00
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:
8 files changed
+154
-1
No files matched your search
@@ -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];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user