Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki-plugin-oauthgeneric
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
709
public
dokuwiki-plugin-oauthgeneric
Commits
420dfed2
Commit
420dfed2
authored
1 year ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
allow to use dot notation on individual group members
parent
bf300a6c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
DotAccess.php
+2
-0
2 additions, 0 deletions
DotAccess.php
action.php
+9
-1
9 additions, 1 deletion
action.php
with
11 additions
and
1 deletion
DotAccess.php
+
2
−
0
View file @
420dfed2
...
@@ -20,6 +20,8 @@ class DotAccess
...
@@ -20,6 +20,8 @@ class DotAccess
*/
*/
public
static
function
get
(
$array
,
$key
,
$default
=
null
)
public
static
function
get
(
$array
,
$key
,
$default
=
null
)
{
{
$key
=
trim
(
$key
,
'.'
);
if
(
!
static
::
accessible
(
$array
))
{
if
(
!
static
::
accessible
(
$array
))
{
return
$default
;
return
$default
;
}
}
...
...
This diff is collapsed.
Click to expand it.
action.php
+
9
−
1
View file @
420dfed2
...
@@ -29,10 +29,18 @@ class action_plugin_oauthgeneric extends Adapter
...
@@ -29,10 +29,18 @@ class action_plugin_oauthgeneric extends Adapter
$result
=
json_decode
(
$raw
,
true
);
$result
=
json_decode
(
$raw
,
true
);
if
(
!
$result
)
throw
new
OAuthException
(
'Failed to parse data from userurl'
);
if
(
!
$result
)
throw
new
OAuthException
(
'Failed to parse data from userurl'
);
$grpdots
=
sexplode
(
'[]'
,
$this
->
getConf
(
'json-grps'
),
2
);
$user
=
DotAccess
::
get
(
$result
,
$this
->
getConf
(
'json-user'
),
''
);
$user
=
DotAccess
::
get
(
$result
,
$this
->
getConf
(
'json-user'
),
''
);
$name
=
DotAccess
::
get
(
$result
,
$this
->
getConf
(
'json-name'
),
''
);
$name
=
DotAccess
::
get
(
$result
,
$this
->
getConf
(
'json-name'
),
''
);
$mail
=
DotAccess
::
get
(
$result
,
$this
->
getConf
(
'json-mail'
),
''
);
$mail
=
DotAccess
::
get
(
$result
,
$this
->
getConf
(
'json-mail'
),
''
);
$grps
=
DotAccess
::
get
(
$result
,
$this
->
getConf
(
'json-grps'
),
[]);
$grps
=
DotAccess
::
get
(
$result
,
$grpdots
[
0
],
[]);
// use dot notation on each group
if
(
is_array
(
$grps
)
&&
$grpdots
[
1
])
{
$grps
=
array_map
(
function
(
$grp
)
use
(
$grpdots
)
{
return
DotAccess
::
get
(
$grp
,
$grpdots
[
1
],
''
);
},
$grps
);
}
// type fixes
// type fixes
if
(
is_array
(
$user
))
$user
=
array_shift
(
$user
);
if
(
is_array
(
$user
))
$user
=
array_shift
(
$user
);
...
...
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