Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
storage
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
storage
Commits
a6738db9
Commit
a6738db9
authored
2 years ago
by
mxh
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3328816
by robertom: Add "access storage overview" permission
parent
50af7bc6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/optional/views.view.storage.yml
+1
-1
1 addition, 1 deletion
config/optional/views.view.storage.yml
storage.permissions.yml
+3
-0
3 additions, 0 deletions
storage.permissions.yml
storage.post_update.php
+40
-0
40 additions, 0 deletions
storage.post_update.php
with
44 additions
and
1 deletion
config/optional/views.view.storage.yml
+
1
−
1
View file @
a6738db9
...
...
@@ -21,7 +21,7 @@ display:
access
:
type
:
perm
options
:
perm
:
'
a
dminister
storage
entit
ie
s
'
perm
:
'
a
ccess
storage
overv
ie
w
'
cache
:
type
:
tag
options
:
{
}
...
...
This diff is collapsed.
Click to expand it.
storage.permissions.yml
+
3
−
0
View file @
a6738db9
...
...
@@ -6,6 +6,9 @@ administer storage entities:
description
:
'
Create,
edit
and
delete
all
storage
entities.'
restrict access
:
true
access storage overview
:
title
:
'
Access
the
overview
page
of
Storage
entities'
delete storage entities
:
title
:
'
Delete
any
Storage
entity'
restrict access
:
true
...
...
This diff is collapsed.
Click to expand it.
storage.post_update.php
0 → 100644
+
40
−
0
View file @
a6738db9
<?php
use
Drupal\user\Entity\Role
;
use
Drupal\views\Entity\View
;
use
Drupal\views\ViewEntityInterface
;
/**
* Migrate "administer storage entities" to "access storage overview".
*/
function
storage_post_update_access_overview_permission
(
&
$sandbox
=
NULL
)
{
foreach
(
Role
::
loadMultiple
()
as
$role
)
{
if
(
$role
->
hasPermission
(
'administer storage entities'
))
{
$role
->
grantPermission
(
'access storage overview'
);
$role
->
save
();
}
}
}
/**
* Update permission required for `storage` view if it exists.
*/
function
storage_post_update_admin_view_permission
(
&
$sandbox
=
NULL
)
{
$view
=
View
::
load
(
'storage'
);
if
(
!
$view
instanceof
ViewEntityInterface
)
{
return
;
}
$display
=&
$view
->
getDisplay
(
'default'
);
if
((
$display
[
'display_options'
][
'access'
][
'type'
]
??
NULL
)
!==
'perm'
||
(
$display
[
'display_options'
][
'access'
][
'options'
][
'perm'
]
??
NULL
)
!==
'administer storage entities'
)
{
return
;
}
$display
[
'display_options'
][
'access'
]
=
[
'type'
=>
'perm'
,
'options'
=>
[
'perm'
=>
'access storage overview'
],
];
$view
->
save
();
}
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