diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Viewer.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Viewer.pm index 62412ce25..ea770f262 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Viewer.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Viewer.pm @@ -59,22 +59,24 @@ sub addRoutes { ['GET'] ); } - unless ( $self->{viewerAllowBrowser} || $conf->{viewerAllowBrowser} ) { + + # Difference between confs + if ( $self->{viewerAllowDiff} ) { + $self->addRoute( + view => { diff => { ':conf1' => { ':conf2' => 'viewDiff' } } } ) + ->addRoute( 'viewDiff.html', undef, ['GET'] ); + } + unless ( $self->{viewerAllowBrowser} ) { $self->addRoute( view => { ':cfgNum' => 'rejectKey' }, ['GET'] ); } - # Difference between confs - if ( $self->{viewerAllowDiff} || $conf->{viewerAllowDiff} ) { - $self->addRoute( - view => { diff => { ':conf1' => { ':conf2' => 'viewDiff' } } } ) - ->addRoute( 'viewDiff.html', undef, ['GET'] ); - } - # Other keys - $self->addRoute( view => { ':cfgNum' => { '*' => 'getKey' } }, ['GET'] ); + else { + $self->addRoute( view => { ':cfgNum' => { '*' => 'getKey' } }, ['GET'] ); + } } sub getConfByNum { diff --git a/lemonldap-ng-manager/site/htdocs/static/languages/it.json b/lemonldap-ng-manager/site/htdocs/static/languages/it.json index b8f4cb5fd..069e279bb 100644 --- a/lemonldap-ng-manager/site/htdocs/static/languages/it.json +++ b/lemonldap-ng-manager/site/htdocs/static/languages/it.json @@ -128,7 +128,7 @@ "casSrvMetaDataOptionsDisplayName":"Nome da visualizzare", "casSrvMetaDataOptionsGateway":"Autenticazione gateway", "casSrvMetaDataOptionsIcon":"Path icona", -"casSrvMetaDataOptionsSortNumber":"Order", +"casSrvMetaDataOptionsSortNumber":"Ordine", "casSrvMetaDataOptionsRenew":"Rinnova l'autenticazione", "casSrvMetaDataOptionsProxiedServices":"Servizi Proxied", "casSrvMetaDataOptionsUrl":"URL del server", @@ -152,11 +152,11 @@ "clickHereToForce":"Clicca qui per forzare", "checkState":"Attivazione", "checkStateSecret":"Segreto condiviso", -"checkUsers":"SSO profile Check", +"checkUsers":"Controllo del profilo SSO", "checkUser":"Attivazione", -"checkUserIdRule":"Identities use rule", -"checkUserHiddenAttributes":"Hidden attributes", -"checkUserDisplayPersistentInfo":"Display persistent session", +"checkUserIdRule":"Uso della regola delle identità", +"checkUserHiddenAttributes":"Attributi nascosti", +"checkUserDisplayPersistentInfo":"Mostra sessione persistente", "checkUserDisplayEmptyValues":"Mostra valori vuoti", "choiceParams":"Scelta parametri", "chooseLogo":"Scegli logo", @@ -250,7 +250,7 @@ "exportedVars":"Variabili esportate", "external2f":"2° fattore esterno", "ext2fActivation":"Attivazione", -"ext2fCodeActivation":"Code regex", +"ext2fCodeActivation":"Codice regex", "ext2fAuthnLevel":"Livello di autenticazione", "ext2fLogo":"Logo", "ext2FSendCommand":"Invia comando", @@ -289,10 +289,10 @@ "hideTree":"Nascondi l'albero", "httpOnly":"Protezione Javascript", "https":"HTTPS", -"impersonation":"Impersonation", -"impersonationRule":"Use rule", -"impersonationIdRule":"Identities use rule", -"impersonationHiddenAttributes":"Hidden attributes", +"impersonation":"Imitazione", +"impersonationRule":"Usa la regola", +"impersonationIdRule":"Le identità usano la regola", +"impersonationHiddenAttributes":"Attributi nascosti", "impersonationMergeSSOgroups":"Unisci gruppi SSO falsificati e reali", "impersonationPrefix":"Prefisso degli attributi reali", "impersonationSkipEmptyValues":"Salta valori vuoti", @@ -500,7 +500,7 @@ "oidcOPMetaDataOptionsDisplayName":"Visualizza nome", "oidcOPMetaDataOptionsDisplayParams":"Visualizza", "oidcOPMetaDataOptionsIcon":"Logo", -"oidcOPMetaDataOptionsSortNumber":"Order", +"oidcOPMetaDataOptionsSortNumber":"Ordine", "oidcOPMetaDataOptionsJWKSTimeout":"Timeout dei dati di JWKS", "oidcRPMetaDataOptionsLogoutSessionRequired":"Sessione necessaria", "oidcRPMetaDataOptionsLogoutType":"Tipo", @@ -651,7 +651,7 @@ "radiusSecret":"Segreto condiviso", "radiusServer":"Nome host del server", "randomPasswordRegexp":"Regex per la generazione di password", -"readOnlyMode":"Read-Only mode", +"readOnlyMode":"Modalità di sola lettura", "redirectFormMethod":"Metodo per il modulo di reindirizzamento", "redirection":"Redirezioni del gestore", "reference":"Riferimento", @@ -896,7 +896,7 @@ "samlIDPMetaDataOptionsDisplayParams":" Visualizza ", "samlIDPMetaDataOptionsIcon":"Logo", "samlIDPMetaDataOptionsSecurity":"Sicurezza", -"samlIDPMetaDataOptionsSortNumber":"Order", +"samlIDPMetaDataOptionsSortNumber":"Ordine", "samlIDPMetaDataOptionsStoreSAMLToken":"Store SAML Token", "samlIDPMetaDataOptionsRelayStateURL":"Consenti l'URL come RelayState", "samlIDPMetaDataOptionsUserAttribute":"Attributo che contiene l'identificatore dell'utente", @@ -985,5 +985,5 @@ "samlCommonDomainCookieWriter":"URL dell'autore", "samlRelayStateTimeout":"Timeout di sessione di RelayState", "samlUseQueryStringSpecific":"Utilizza il metodo specifico query_string", -"samlOverrideIDPEntityID":"Override Entity ID when acting as IDP" +"samlOverrideIDPEntityID":"Sostituisci l'ID entità quando agisce come IDP" } \ No newline at end of file diff --git a/lemonldap-ng-manager/t/70-viewer.t b/lemonldap-ng-manager/t/70-viewer.t index b096f6708..553db18b5 100644 --- a/lemonldap-ng-manager/t/70-viewer.t +++ b/lemonldap-ng-manager/t/70-viewer.t @@ -8,6 +8,7 @@ use JSON qw(from_json); require 't/test-lib.pm'; my $struct = 't/jsonfiles/70-diff.json'; + sub body { return IO::File->new( $struct, 'r' ); } @@ -19,9 +20,11 @@ count(1); # Test that hidden key values are NOT sent $res = &client->jsonResponse('/view/1/portalDisplayLogout'); -ok( $res->{value} eq '_Hidden_', 'Key is hidden' ); +ok( $res->{value} eq '_Hidden_', 'Key is hidden' ) + or explain( $res, 'value => "_Hidden_"' ); $res = &client->jsonResponse('/view/1/samlIDPMetaDataNodes'); -ok( $res->{value} eq '_Hidden_', 'Key is hidden' ); +ok( $res->{value} eq '_Hidden_', 'Key is hidden' ) + or explain( $res, 'value => "_Hidden_"' ); count(2); # Try to display latest conf @@ -29,12 +32,17 @@ $res = &client->jsonResponse('/view/latest'); ok( $res->{cfgNum} eq '1', 'Browser is allowed' ); count(1); -ok( $res = &client->_post( '/confs/', 'cfgNum=1&force=1', &body, 'application/json' ), - "Request succeed" ); +ok( + $res = &client->_post( + '/confs/', 'cfgNum=1&force=1', &body, 'application/json' + ), + "Request succeed" +); ok( $res->[0] == 200, "Result code is 200" ); my $resBody; ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" ); count(3); + foreach my $i ( 0 .. 1 ) { ok( $resBody->{details}->{__changes__}->[$i]->{key} =~ @@ -46,10 +54,11 @@ count(2); # Try to compare confs 1 & 2 $res = &client->jsonResponse('/view/diff/1/2'); + # ok( $res->[1]->{captcha_login_enabled} eq '1', 'Key found' ); ok( $res->[1]->{captcha_mail_enabled} eq '0', 'Key found' ); -ok( 6 == keys %{ $res->[1] }, 'Right number of keys found') -or print STDERR Dumper($res); +ok( 6 == keys %{ $res->[1] }, 'Right number of keys found' ) + or print STDERR Dumper($res); count(2); # Remove new conf diff --git a/lemonldap-ng-manager/t/71-viewer-with-no-diff.t b/lemonldap-ng-manager/t/71-viewer-with-no-diff.t index 8e58345b3..8fee87c90 100644 --- a/lemonldap-ng-manager/t/71-viewer-with-no-diff.t +++ b/lemonldap-ng-manager/t/71-viewer-with-no-diff.t @@ -21,13 +21,10 @@ ok( 'Client object' ); -# Try to display latest conf -my $res = $client2->jsonResponse('/view/1'); -ok( $res->{value} eq '_Hidden_', 'Browser is NOT allowed' ); -count(2); + # Try to compare confs 1 & 2 -ok( $res = $client2->_post( '/confs/', 'cfgNum=1&force=1', &body, 'application/json' ), +ok( my $res = $client2->_post( '/confs/', 'cfgNum=1&force=1', &body, 'application/json' ), "Request succeed" ); ok( $res->[0] == 200, "Result code is 200" ); my $resBody; @@ -45,6 +42,11 @@ $res = $client2->jsonResponse('/view/diff/1/2'); ok( $res->{value} eq '_Hidden_', 'Diff is NOT allowed' ); count(1); +# Try to display latest conf +$res = $client2->jsonResponse('/view/2'); +ok( $res->{value} eq '_Hidden_', 'Browser is NOT allowed' ); +count(2); + # Remove new conf `rm -rf t/conf/lmConf-2.json`;