privileged user

This commit is contained in:
Hemachandar
2026-01-30 16:24:08 +05:30
parent 2f5a5e3387
commit 096ea90698
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -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);