Skip to content
Snippets Groups Projects
Commit 0a0ea39f authored by Eirik Morland's avatar Eirik Morland
Browse files

Issue #3447675 by eiriksm: add a permission to access all teams

parent 406be16b
No related branches found
No related tags found
1 merge request!53Resolve #3447675 "Add a permission"
Pipeline #175975 passed with warnings
......@@ -28,6 +28,9 @@ final class TeamAccess implements AccessInterface {
if (!$team instanceof TeamNode) {
return AccessResult::neutral('No team node found');
}
if ($this->currentUser->hasPermission('administer all teams')) {
return AccessResult::allowed();
}
// @todo In theory we could add more types here. For example, it could
// theoretically be wanted to show something to members only, but not to
// admins. Currently that is not really needed though.
......
......@@ -14,6 +14,21 @@ use Symfony\Component\Routing\Route;
*/
class TeamAccessTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp(): void {
parent::setUp();
// Just make sure we have a completely different user with user id 1, since
// otherwise these permission checks will always allow access to the first
// user of the test.
$user = User::create([
'name' => 'admin',
'mail' => 'admin@example.com',
]);
$user->save();
}
/**
* Test access.
*
......
administer all teams:
restrict_access: true
description: Administer all teams
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment