Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ansible-warpzone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infrastruktur
ansible-warpzone
Commits
8b0b9d6e
Commit
8b0b9d6e
authored
1 month ago
by
Christian Elberfeld
Browse files
Options
Downloads
Patches
Plain Diff
fixed script
parent
894d8a91
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
testserver/docker_wordpress/Documentation.md
+25
-21
25 additions, 21 deletions
testserver/docker_wordpress/Documentation.md
with
25 additions
and
21 deletions
testserver/docker_wordpress/Documentation.md
+
25
−
21
View file @
8b0b9d6e
...
...
@@ -68,27 +68,31 @@ Benutzer, mit der Gruppe 'wordpress_admin' in uddf erhalten Administrator-Berech
Alle anderen Benutzer erhalten Editor-Berechtigungen.
```
add_action('openid-connect-generic-update-user-using-current-claim', function( $user, $user_claim) {
// Based on some data in the user_claim, modify the user.
foreach($user_claim as $key => $value) {
error_log('Openid Role mapping: User claim: ' . $key . ', Value: ' . $value);
}
if ( array_key_exists( 'groups', $user_claim ) ) {
error_log('Openid Role mapping: Groups: ' . implode(',',$user_claim['groups']));
if ( in_array('wordpress_admin', $user_claim['groups'] )) {
error_log('Openid Role mapping: Set role: Administrator');
$user->set_role( 'administrator' );
}
else {
error_log('Openid Role mapping: Set role: Editor');
$user->set_role( 'editor' );
}
add_action('openid-connect-generic-update-user-using-current-claim', function($user, $user_claim) {
// Log all user claims safely
foreach($user_claim as $key => $value) {
$valueToLog = is_array($value) ? json_encode($value) : $value;
error_log('Openid Role mapping: User claim: ' . $key . ', Value: ' . $valueToLog);
}
if (array_key_exists('groups', $user_claim)) {
// Ensure groups is an array before working with it
if (is_array($user_claim['groups'])) {
error_log('Openid Role mapping: Groups: ' . implode(',', $user_claim['groups']));
if (in_array('wordpress_admin', $user_claim['groups'])) {
error_log('Openid Role mapping: Set role: Administrator');
$user->set_role('administrator');
} else {
error_log('Openid Role mapping: Set role: Editor');
$user->set_role('editor');
}
} else {
// If groups is not an array, log its actual format
error_log('Openid Role mapping: Groups is not an array: ' . gettype($user_claim['groups']));
error_log('Openid Role mapping: Groups value: ' . json_encode($user_claim['groups']));
}
}
}, 10, 2);
```
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