Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai
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
ai
Merge requests
!400
re-add permission for this module
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
re-add permission for this module
issue/ai-3498628:3498628-restore-permission
into
1.0.x
Overview
0
Commits
1
Pipelines
2
Changes
2
Merged
wouters_f
requested to merge
issue/ai-3498628:3498628-restore-permission
into
1.0.x
4 months ago
Overview
0
Commits
1
Pipelines
2
Changes
2
Expand
Closes
#3498628
0
0
Merge request reports
Compare
1.0.x
1.0.x (base)
and
latest version
latest version
72034828
1 commit,
4 months ago
2 files
+
11
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
modules/ai_content_suggestions/ai_content_suggestions.module
+
8
−
4
Options
@@ -30,8 +30,12 @@ function ai_content_suggestions_form_taxonomy_term_tags_form_alter(&$form, FormS
* The form state.
*/
function
ai_content_suggestions_alter_form
(
array
&
$form
,
FormStateInterface
$form_state
):
void
{
\Drupal
::
service
(
'ai_content_suggestions.form_alter'
)
->
alter
(
$form
,
$form_state
);
$form
[
'#cache'
][
'contexts'
][]
=
'user.permissions'
;
$form
[
'#cache'
][
'contexts'
][]
=
'ai_content_suggestions_plugins'
;
$form
[
'#cache'
][
'contexts'
][]
=
'ai_providers'
;
$user
=
\Drupal
::
currentUser
();
$hasPermission
=
$user
->
hasPermission
(
'access ai content suggestion tools'
);
if
(
$hasPermission
)
{
\Drupal
::
service
(
'ai_content_suggestions.form_alter'
)
->
alter
(
$form
,
$form_state
);
$form
[
'#cache'
][
'contexts'
][]
=
'user.permissions'
;
$form
[
'#cache'
][
'contexts'
][]
=
'ai_content_suggestions_plugins'
;
$form
[
'#cache'
][
'contexts'
][]
=
'ai_providers'
;
}
}
Loading