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
251e8b96
Commit
251e8b96
authored
10 months ago
by
Eirik Morland
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3440544
by eiriksm: Remove team settings controller and use access service instead
parent
81d69619
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!49
clean up
Pipeline
#145141
passed with warnings
10 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Controller/TeamSettingsController.php
+0
-43
0 additions, 43 deletions
src/Controller/TeamSettingsController.php
violinist_teams.routing.yml
+1
-1
1 addition, 1 deletion
violinist_teams.routing.yml
with
1 addition
and
44 deletions
src/Controller/TeamSettingsController.php
deleted
100644 → 0
+
0
−
43
View file @
81d69619
<?php
namespace
Drupal\violinist_teams\Controller
;
use
Drupal\Core\Access\AccessResult
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\Core\Session\AccountProxyInterface
;
use
Drupal\violinist_teams
\TeamNode
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Controller that currently only controls the access.
*/
class
TeamSettingsController
extends
ControllerBase
{
/**
* Construct this controller.
*/
public
function
__construct
(
AccountProxyInterface
$currentUser
)
{
$this
->
currentUser
=
$currentUser
;
}
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'current_user'
)
);
}
/**
* Access callback for a couple things.
*/
public
function
accessTeamSettings
(
TeamNode
$team
)
{
// Admins on the site should be able to access it.
if
(
$team
->
access
(
'update'
,
$this
->
currentUser
))
{
return
AccessResult
::
allowed
();
}
return
AccessResult
::
allowedIf
(
in_array
(
$this
->
currentUser
->
id
(),
$team
->
getAdministratorIds
()));
}
}
This diff is collapsed.
Click to expand it.
violinist_teams.routing.yml
+
1
−
1
View file @
251e8b96
...
...
@@ -32,7 +32,7 @@ violinist_teams.team_settings:
team
:
type
:
entity:node
requirements
:
_
custom_access
:
'
\Drupal\violinist_teams\Controller\TeamSettingsController::accessTeamSettings
'
_
violinist_teams_access
:
'
admin_or_member
'
violinist_teams.team_members
:
path
:
'
/teams/{team}/members'
...
...
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