Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
violinist_teams
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
violinist_teams
Commits
0a0ea39f
Commit
0a0ea39f
authored
9 months ago
by
Eirik Morland
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3447675
by eiriksm: add a permission to access all teams
parent
406be16b
No related branches found
No related tags found
1 merge request
!53
Resolve #3447675 "Add a permission"
Pipeline
#175975
passed with warnings
9 months ago
Stage: build
Stage: validate
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Access/TeamAccess.php
+3
-0
3 additions, 0 deletions
src/Access/TeamAccess.php
tests/src/Kernel/TeamAccessTest.php
+15
-0
15 additions, 0 deletions
tests/src/Kernel/TeamAccessTest.php
violinist_teams.permissions.yml
+3
-0
3 additions, 0 deletions
violinist_teams.permissions.yml
with
21 additions
and
0 deletions
src/Access/TeamAccess.php
+
3
−
0
View file @
0a0ea39f
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
tests/src/Kernel/TeamAccessTest.php
+
15
−
0
View file @
0a0ea39f
...
...
@@ -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.
*
...
...
This diff is collapsed.
Click to expand it.
violinist_teams.permissions.yml
0 → 100644
+
3
−
0
View file @
0a0ea39f
administer all teams
:
restrict_access
:
true
description
:
Administer all teams
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment