Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
bibliossimo
opacce
Commits
f50576d3
Commit
f50576d3
authored
May 17, 2018
by
Ghislain Loas
Browse files
dev #72845 implode Cvs dashboard : add SSO link generation process
parent
9671dc85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletion
+49
-1
library/Class/DigitalResource/Config.php
library/Class/DigitalResource/Config.php
+5
-0
library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
...ary/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
+10
-1
library/digital_resources/Cvs/Config.php
library/digital_resources/Cvs/Config.php
+34
-0
No files found.
library/Class/DigitalResource/Config.php
View file @
f50576d3
...
...
@@ -270,6 +270,11 @@ class Class_DigitalResource_Config extends Class_Entity {
}
public
function
renderSSODiagOn
(
$view
)
{
return
''
;
}
public
function
getTestUser
()
{
$login
=
$this
->
getName
()
.
'_test_user'
;
$user
=
(
$user
=
Class_Users
::
findFirstBy
([
'login'
=>
$login
]))
...
...
library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
View file @
f50576d3
...
...
@@ -63,7 +63,11 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_SSO extends ZendAfi_View_Hel
$html
[]
=
$this
->
_tag
(
'h4'
,
$this
->
_
(
'URL SSO générée par /modules/%s pour l\'utilisateur "%s"'
,
$config
->
getSsoAction
(),
$user
->
getLogin
()));
$html
[]
=
$this
->
_tag
(
'pre'
,
$config
->
urlFor
(
$user
));
$html
[]
=
(
$diag
=
$config
->
renderSSODiagOn
(
$this
->
view
))
?
$diag
:
$this
->
_getSSOHtml
(
$config
,
$user
);
$html
[]
=
$this
->
view
->
button
((
new
Class_Entity
)
->
setUrl
(
$this
->
view
->
url
([
'action'
=>
'try-sso'
]))
->
setText
(
$this
->
_
(
'Essayer le SSO avec l\'utilisateur "%s"'
,
...
...
@@ -77,6 +81,11 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_SSO extends ZendAfi_View_Hel
}
protected
function
_getSSOHtml
(
$config
,
$user
)
{
return
$this
->
_tag
(
'pre'
,
$config
->
urlFor
(
$user
));
}
protected
function
_getAlbumSSOUrlHtml
(
$config
,
$user
)
{
if
(
!
$album
=
Class_Album
::
findFirstby
([
'type_doc_id'
=>
$config
->
getDocType
()]))
return
''
;
...
...
library/digital_resources/Cvs/Config.php
View file @
f50576d3
...
...
@@ -157,4 +157,38 @@ class Cvs_Config extends Class_DigitalResource_Config {
return
implode
(
$html
);
}
public
function
renderSSODiagOn
(
$view
)
{
$user
=
$this
->
getTestUser
();
$service
=
new
Cvs_Service
;
$service
->
setUser
(
$user
);
$xml
=
$service
->
getSiteAccessXML
(
$user
);
$encoded_xml
=
$service
->
getEncodedXML
(
$xml
);
$original_response
=
$service
->
httpPost
(
$xml
);
$response
=
htmlentities
(
$original_response
);
$parser
=
new
Cvs_Service_Parser_SiteAccess
();
$parser
->
parseXML
(
$original_response
);
$url
=
(
$url
=
$parser
->
getUrl
())
?
$url
:
''
;
$html
=
[
$view
->
tag
(
'p'
,
$this
->
_
(
'Pour générer le lien de connexion SSO, plusieurs étapes sont nécessaires.'
)),
$view
->
tag
(
'h4'
,
$this
->
_
(
'La première étape consiste à générer le XML qui servirat à la génération du paramètre "xml"'
)),
$view
->
tag
(
'pre'
,
htmlentities
(
$xml
)),
$view
->
tag
(
'h4'
,
$this
->
_
(
'L\'étape suivante est une requête HTTP POST vers l\'API_URL avec le paramètre "xml" encodé'
)),
$view
->
tag
(
'p'
,
$this
->
_
(
'API URL:'
)),
$view
->
tag
(
'pre'
,
$this
->
getAdminVar
(
'API_URL'
)),
$view
->
tag
(
'p'
,
$this
->
_
(
'XML encodé:'
)),
$view
->
tag
(
'pre'
,
$encoded_xml
),
$view
->
tag
(
'p'
,
$this
->
_
(
'Réponse reçue à la demande d\'accès au site :'
)),
$view
->
tag
(
'pre'
,
$response
),
$view
->
tag
(
'h4'
,
$this
->
_
(
'La dernière étape parcourt la réponse afin de récupérer l\'url de SSO'
)),
$view
->
tag
(
'pre'
,
$url
)
];
return
implode
(
$html
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment