Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tfa-3386240
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
tfa-3386240
Commits
a21aebc8
Commit
a21aebc8
authored
2 years ago
by
Mingsong Hu
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2930355
: Add tfa_update_8013() and fix coding standard issue.
parent
eb96196c
No related branches found
Tags
previous/2930355-39/2022-10-16
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tfa.install
+26
-0
26 additions, 0 deletions
tfa.install
tfa.services.yml
+1
-1
1 addition, 1 deletion
tfa.services.yml
with
27 additions
and
1 deletion
tfa.install
+
26
−
0
View file @
a21aebc8
...
...
@@ -307,3 +307,29 @@ function tfa_update_8012() {
->
clear
(
'cookie_name'
)
->
save
();
}
/**
* Grant eligible users with "reset pass skip tfa" permission.
*
* Set default value as true for 'reset_pass_skip_enabled'.
*/
function
tfa_update_8013
()
{
if
(
$roles
=
Role
::
loadMultiple
())
{
foreach
(
$roles
as
$role
)
{
if
(
$role
->
hasPermission
(
'administer tfa for other users'
)
&&
$role
->
hasPermission
(
'admin tfa settings'
))
{
// The user role has 'admin tfa settings'
// and 'administer tfa for other users' permission already.
// Grant the new permssion to this user role.
$role
->
grantPermission
(
'reset pass skip tfa'
);
$role
->
save
();
}
}
}
$config
=
\Drupal
::
configFactory
()
->
getEditable
(
'tfa.settings'
);
// Allow administrator role to skip TFA
// by defualt, when resetting password.
$config
->
set
(
'reset_pass_skip_enabled'
,
TRUE
)
->
save
();
}
This diff is collapsed.
Click to expand it.
tfa.services.yml
+
1
−
1
View file @
a21aebc8
...
...
@@ -17,4 +17,4 @@ services:
tfa.route_subscriber
:
class
:
Drupal\tfa\Routing\TfaRouteSubscriber
tags
:
-
{
name
:
event_subscriber
}
\ No newline at end of file
-
{
name
:
event_subscriber
}
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