Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
visual_debugger
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
visual_debugger
Commits
bd5da5da
Commit
bd5da5da
authored
10 months ago
by
Marcos Hollanda
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3479462
by mabho: Create a new permission to limit the user roles that can see the debugger
parent
e8a51e6c
No related branches found
No related tags found
1 merge request
!18
Create a new permission to limit the user roles that can see the Visual Debugger panel.
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
visual_debugger.module
+9
-1
9 additions, 1 deletion
visual_debugger.module
visual_debugger.permissions.yml
+5
-3
5 additions, 3 deletions
visual_debugger.permissions.yml
with
14 additions
and
4 deletions
visual_debugger.module
+
9
−
1
View file @
bd5da5da
...
...
@@ -53,13 +53,21 @@ function visual_debugger_page_attachments(array &$attachments): void {
$use_on_frontend
=
$config
->
get
(
VisualDebuggerConstants
::
IS_FRONTEND_KEY
);
$use_on_admin
=
$config
->
get
(
VisualDebuggerConstants
::
IS_ADMIN_KEY
);
// Checking one of these possibilities:
// Get the current user service.
$current_user
=
\Drupal
::
currentUser
();
$has_permission
=
$current_user
->
hasPermission
(
'view visual_debugger panel'
);
// Validates if user has permission to view the Visual Debugger panel, and
// checks for one of these possibilities:
// - This is an Admin page, and debugger is activated for admin theme.
// - This is a frontend page, and debugger is activated for frontend theme.
if
(
$has_permission
&&
(
(
$is_admin_theme
&&
$use_on_admin
)
||
(
!
$is_admin_theme
&&
$use_on_frontend
)
)
)
{
// Attach the library.
$attachments
[
'#attached'
][
'library'
][]
=
'visual_debugger/visual_debugger'
;
...
...
This diff is collapsed.
Click to expand it.
visual_debugger.permissions.yml
+
5
−
3
View file @
bd5da5da
administer visual_debugger configuration
:
title
:
"
Administer
visual_debugger
configuration"
description
:
"
Optional
description."
restrict access
:
true
title
:
"
Administer
the
Visual
Debugger
configuration"
restrict access
:
false
view visual_debugger panel
:
title
:
"
View
the
Visual
Debugger
panel"
restrict access
:
false
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