Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp-module-perun
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
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp-module-perun
Commits
5f0f625b
Commit
5f0f625b
authored
2 years ago
by
Dominik Baránek
Committed by
Pavel Břoušek
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
perf: use getFacilitiesByAttributeWithAttributes
parent
c08a7ae1
No related branches found
No related tags found
1 merge request
!300
refactor: use getFacilitiesByAttributeWithAttributes
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/AdapterRpc.php
+20
-0
20 additions, 0 deletions
lib/AdapterRpc.php
lib/MetadataFromPerun.php
+15
-21
15 additions, 21 deletions
lib/MetadataFromPerun.php
www/listOfSps.php
+12
-12
12 additions, 12 deletions
www/listOfSps.php
with
47 additions
and
33 deletions
lib/AdapterRpc.php
+
20
−
0
View file @
5f0f625b
...
...
@@ -824,6 +824,26 @@ class AdapterRpc extends Adapter
return
$this
->
connector
->
post
(
'facilitiesManager'
,
'createFacility'
,
$facility
);
}
public
function
getFacilitiesByAttributeWithAttributes
(
$attributeName
,
$attributeValue
,
$attrNames
)
{
$facilitiesWithAttributes
=
$this
->
connector
->
post
(
'facilitiesManager'
,
'getFacilitiesByAttributeWithAttributes'
,
[
'attributeName'
=>
$attributeName
,
'attributeValue'
=>
$attributeValue
,
'attrNames'
=>
$attrNames
]
);
$attrNamesMap
=
AttributeUtils
::
getRpcAttrNames
(
$attrNames
);
foreach
(
$facilitiesWithAttributes
as
$facilityWithAttributes
)
{
$facilityWithAttributes
[
'attributes'
]
=
$this
->
getAttributes
(
$facilityWithAttributes
[
'attributes'
],
$attrNamesMap
);
}
return
$facilitiesWithAttributes
;
}
private
function
getAttributes
(
$perunAttrs
,
$attrNamesMap
)
{
$attributes
=
[];
...
...
This diff is collapsed.
Click to expand it.
lib/MetadataFromPerun.php
+
15
−
21
View file @
5f0f625b
...
...
@@ -172,42 +172,36 @@ class MetadataFromPerun
return
$allAttrNames
;
}
/**
* Get all facilities with proxyIdentifiers.
*/
private
function
getFacilities
()
{
$perunProxyIdentifierAttr
=
$this
->
conf
->
getString
(
self
::
PERUN_PROXY_IDENTIFIER_ATTR_NAME
);
$perunProxyIdentifierRpcAttrName
=
AttributeUtils
::
getRpcAttrName
(
$perunProxyIdentifierAttr
);
$proxyIdentifier
=
$this
->
conf
->
getString
(
self
::
PROXY_IDENTIFIER
);
$attributeDefinition
=
[
$perunProxyIdentifierRpcAttrName
=>
$proxyIdentifier
,
];
return
$this
->
rpcAdapter
->
searchFacilitiesByAttributeValue
(
$attributeDefinition
);
}
/*+
* Get facilities with attributes.
*/
private
function
getFacilitiesWithAttributes
()
{
$perunProxyIdentifierAttr
=
$this
->
conf
->
getString
(
self
::
PERUN_PROXY_IDENTIFIER_ATTR_NAME
);
$perunProxyIdentifierRpcAttrName
=
AttributeUtils
::
getRpcAttrName
(
$perunProxyIdentifierAttr
);
$allAttrNames
=
$this
->
getAllAttributeNames
();
$facilitiesWithAttributes
=
[];
foreach
(
$this
->
getFacilities
()
as
$facility
)
{
$attributes
=
$this
->
rpcAdapter
->
getFacilityAttributes
(
$facility
,
$allAttrNames
);
$facilitiesWithAttributes
=
$this
->
rpcAdapter
->
getFacilitiesByAttributeWithAttributes
(
$perunProxyIdentifierRpcAttrName
,
$this
->
conf
->
getString
(
self
::
PROXY_IDENTIFIER
),
$allAttrNames
);
$facilitiesWithAttributesRes
=
[];
foreach
(
$facilitiesWithAttributes
as
$facilityWithAttributes
)
{
$attributes
=
$facilityWithAttributes
[
'attributes'
];
$facilityAttributes
=
[];
foreach
(
$attributes
as
$attribute
)
{
$facilityAttributes
[
$attribute
[
'name'
]]
=
$attribute
;
}
if
(
!
empty
(
$facilityAttributes
[
$this
->
perunProxyEntityIDAttr
][
'value'
]))
{
$facilitiesWithAttributes
[
$facility
->
getId
()
]
=
[
'facility'
=>
$facility
,
$facilitiesWithAttributes
Res
[
$facility
WithAttributes
[
'facility'
][
'id'
]
]
=
[
'facility'
=>
$facility
WithAttributes
[
'facility'
]
,
self
::
FACILITY_ATTRIBUTES
=>
$facilityAttributes
,
];
}
}
return
$facilitiesWithAttributes
;
return
$facilitiesWithAttributes
Res
;
}
}
This diff is collapsed.
Click to expand it.
www/listOfSps.php
+
12
−
12
View file @
5f0f625b
...
...
@@ -74,12 +74,7 @@ $perunShowOnServiceListAttr
=
$conf
->
getString
(
PERUN_SHOW_ON_SERVICE_LIST_ATTR_NAME
,
null
);
$showProtocol
=
$conf
->
getBoolean
(
PERUN_SHOW_PROTOCOL
,
true
);
$rpcAdapter
=
new
AdapterRpc
();
$attributeDefinition
=
[];
$attributeDefinition
[
$perunProxyIdentifierAttr
]
=
$proxyIdentifier
;
$facilities
=
$rpcAdapter
->
searchFacilitiesByAttributeValue
(
$attributeDefinition
);
$attrNames
=
[];
...
...
@@ -105,16 +100,21 @@ $samlServices = [];
$oidcServices
=
[];
$samlTestServicesCount
=
0
;
$oidcTestServicesCount
=
0
;
foreach
(
$facilities
as
$facility
)
{
$attributes
=
$rpcAdapter
->
getFacilityAttributes
(
$facility
,
$attrNames
);
$facilitiesWithAttributes
=
$rpcAdapter
->
getFacilitiesByAttributeWithAttributes
(
$perunProxyIdentifierAttr
,
$proxyIdentifier
,
$attrNames
);
foreach
(
$facilitiesWithAttributes
as
$facilityWithAttributes
)
{
$facilityAttributes
=
[];
foreach
(
$attributes
as
$attribute
)
{
foreach
(
$
facilityWithAttributes
[
'
attributes
'
]
as
$attribute
)
{
$facilityAttributes
[
$attribute
[
'name'
]]
=
$attribute
;
}
if
(
!
empty
(
$facilityAttributes
[
$perunSaml2EntityIdAttr
][
'value'
]))
{
$samlServices
[
$facility
->
getId
()
]
=
[
'facility'
=>
$facility
,
$samlServices
[
$facility
WithAttributes
[
'facility'
][
'id'
]
]
=
[
'facility'
=>
$facility
WithAttributes
[
'facility'
]
,
'name'
=>
$facilityAttributes
[
$perunServiceNameAttr
],
'loginURL'
=>
$facilityAttributes
[
$perunLoginURLAttr
],
'showOnServiceList'
=>
$facilityAttributes
[
$perunShowOnServiceListAttr
],
...
...
@@ -126,8 +126,8 @@ foreach ($facilities as $facility) {
}
if
(
$showOIDCServices
&&
!
empty
(
$facilityAttributes
[
$perunOidcClientIdAttr
][
'value'
]))
{
$oidcServices
[
$facility
->
getId
()
]
=
[
'facility'
=>
$facility
,
$oidcServices
[
$facility
WithAttributes
[
'facility'
][
'id'
]
]
=
[
'facility'
=>
$facility
WithAttributes
[
'facility'
]
,
'name'
=>
$facilityAttributes
[
$perunServiceNameAttr
],
'loginURL'
=>
$facilityAttributes
[
$perunLoginURLAttr
],
'showOnServiceList'
=>
$facilityAttributes
[
$perunShowOnServiceListAttr
],
...
...
This diff is collapsed.
Click to expand it.
Jednotné přihlášení test
@9008807
mentioned in commit
f574a8b5
·
2 years ago
mentioned in commit
f574a8b5
mentioned in commit f574a8b51ceeb3cd09eb9e3ac674064ea5b647e7
Toggle commit list
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