1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

extend tests

This commit is contained in:
Torsten Dittmann 2021-09-03 18:05:50 +02:00
parent 1f7bad1560
commit 978f15c1c1

View file

@ -243,6 +243,42 @@ class AuthTest extends TestCase
}
public function testPrivilegedUserRoles()
{
Authorization::setRole('role:'.Auth::USER_ROLE_OWNER);
$user = new Document([
'$id' => '123',
'memberships' => [
[
'teamId' => 'abc',
'roles' => [
'administrator',
'moderator'
]
],
[
'teamId' => 'def',
'roles' => [
'guest'
]
]
]
]);
$roles = Auth::getRoles($user);
$this->assertCount(5, $roles);
$this->assertNotContains('role:member', $roles);
$this->assertNotContains('user:123', $roles);
$this->assertContains('team:abc', $roles);
$this->assertContains('team:abc/administrator', $roles);
$this->assertContains('team:abc/moderator', $roles);
$this->assertContains('team:def', $roles);
$this->assertContains('team:def/guest', $roles);
Authorization::reset();
}
public function testAppUserRoles()
{
Authorization::setRole('role:'.Auth::USER_ROLE_APP);
$user = new Document([