Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
108c7279
"README.md" did not exist on "696b970fcaf73d30eb9b7bf2b9f6e4ef3026a968"
Commit
108c7279
authored
8 years ago
by
UQAM\rioux_vi
Browse files
Options
Downloads
Patches
Plain Diff
Code adjust according to comments.
parent
b0029aa5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/consent/lib/Auth/Process/Consent.php
+37
-22
37 additions, 22 deletions
modules/consent/lib/Auth/Process/Consent.php
with
37 additions
and
22 deletions
modules/consent/lib/Auth/Process/Consent.php
+
37
−
22
View file @
108c7279
...
...
@@ -154,30 +154,45 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
if
(
count
(
$option
)
===
count
(
$option
,
COUNT_RECURSIVE
))
{
// Array is not multidimensional. Simple in_array search suffices
return
in_array
(
$entityId
,
$option
,
true
);
}
else
{
// Array contains at least one element that is an array, verify both possibilities
if
(
in_array
(
$entityId
,
$option
,
true
))
{
return
true
;
}
else
{
// Search in multidimensional arrays
foreach
(
$option
as
$optionToTest
)
{
if
(
is_array
(
$optionToTest
))
{
if
(
array_key_exists
(
'type'
,
$optionToTest
))
{
if
(
$optionToTest
[
'type'
]
===
'regex'
)
{
if
(
array_key_exists
(
'pattern'
,
$optionToTest
))
{
// Evaluate regular expression and return true if entityId matches
if
(
preg_match
(
$optionToTest
[
'pattern'
],
$entityId
)
===
1
)
{
return
true
;
}
}
}
}
}
}
// Array contains at least one element that is an array, verify both possibilities
if
(
in_array
(
$entityId
,
$option
,
true
))
{
return
true
;
}
// Search in multidimensional arrays
foreach
(
$option
as
$optionToTest
)
{
if
(
!
is_array
(
$optionToTest
))
{
continue
;
// bad option
}
if
(
!
array_key_exists
(
'type'
,
$optionToTest
))
{
continue
;
// option has no type
}
// Option has a type - switch processing depending on type value :
if
(
$optionToTest
[
'type'
]
===
'regex'
)
{
// regex-based consent disabling
if
(
!
array_key_exists
(
'pattern'
),
$optionToTest
)
{
continue
;
// no pattern defined
}
if
(
preg_match
(
$optionToTest
[
'pattern'
],
$entityId
)
===
1
)
{
return
true
;
}
// Base case : no match
return
false
;
}
else
{
// option type is not supported
continue
;
}
}
}
// end foreach
// Base case : no match
return
false
;
}
else
{
return
(
boolean
)
$option
;
}
...
...
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