mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
privileged user
This commit is contained in:
@@ -273,7 +273,7 @@ App::init()
|
||||
}
|
||||
|
||||
/**
|
||||
* For listing, updating and deleting projects, we use platform DB.
|
||||
* For console projects resource, we use platform DB.
|
||||
* Enabling authorization restricts admin user to the projects they have access to.
|
||||
*/
|
||||
if ($project->getId() === 'console' && str_starts_with($route->getPath(), '/v1/projects')) {
|
||||
|
||||
@@ -39,7 +39,7 @@ class User extends Document
|
||||
{
|
||||
$roles = [];
|
||||
|
||||
if (!$this->isPrivileged($authorization->getRoles()) && !$this->isApp($authorization->getRoles())) {
|
||||
if (!$this->isApp($authorization->getRoles())) {
|
||||
if ($this->getId()) {
|
||||
$roles[] = Role::user($this->getId())->toString();
|
||||
$roles[] = Role::users()->toString();
|
||||
|
||||
@@ -307,11 +307,11 @@ class UserTest extends TestCase
|
||||
]);
|
||||
$roles = $user->getRoles($this->getAuthorization());
|
||||
|
||||
$this->assertCount(7, $roles);
|
||||
$this->assertNotContains(Role::users()->toString(), $roles);
|
||||
$this->assertNotContains(Role::user(ID::custom('123'))->toString(), $roles);
|
||||
$this->assertNotContains(Role::users(Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||
$this->assertNotContains(Role::user(ID::custom('123'), Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||
$this->assertCount(11, $roles);
|
||||
$this->assertContains(Role::users()->toString(), $roles);
|
||||
$this->assertContains(Role::user(ID::custom('123'))->toString(), $roles);
|
||||
$this->assertContains(Role::users(Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||
$this->assertContains(Role::user(ID::custom('123'), Roles::DIMENSION_VERIFIED)->toString(), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'))->toString(), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'), 'administrator')->toString(), $roles);
|
||||
$this->assertContains(Role::team(ID::custom('abc'), 'moderator')->toString(), $roles);
|
||||
|
||||
Reference in New Issue
Block a user