mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Assign verified/unverified role to users
This commit is contained in:
parent
c5ee4d7eaf
commit
381a26fa4c
1 changed files with 12 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ use Appwrite\Auth\Hash\Phpass;
|
|||
use Appwrite\Auth\Hash\Scrypt;
|
||||
use Appwrite\Auth\Hash\Scryptmodified;
|
||||
use Appwrite\Auth\Hash\Sha;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Database\DateTime;
|
||||
use Utopia\Database\Role;
|
||||
|
|
@ -421,6 +422,17 @@ class Auth
|
|||
if ($user->getId()) {
|
||||
$roles[] = Role::user($user->getId())->toString();
|
||||
$roles[] = Role::users()->toString();
|
||||
|
||||
$emailVerified = $user->getAttribute('emailVerification', false);
|
||||
$phoneVerified = $user->getAttribute('phoneVerification', false);
|
||||
|
||||
if ($emailVerified || $phoneVerified) {
|
||||
$roles[] = Role::user($user->getId(), Database::DIMENSION_VERIFIED)->toString();
|
||||
$roles[] = Role::users(Database::DIMENSION_VERIFIED)->toString();
|
||||
} else {
|
||||
$roles[] = Role::user($user->getId(), Database::DIMENSION_UNVERIFIED)->toString();
|
||||
$roles[] = Role::users(Database::DIMENSION_UNVERIFIED)->toString();
|
||||
}
|
||||
} else {
|
||||
return [Role::guests()->toString()];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue