mirror of
https://github.com/anikeen-com/id.git
synced 2026-11-08 00:28:32 +00:00
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.
23 lines
472 B
PHP
23 lines
472 B
PHP
<?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];
|
|
}
|
|
}
|