Don't store 'false' values in default

This commit is contained in:
Xavier Guimard 2017-01-24 21:02:04 +00:00
parent bbb4bd6df1
commit a9e8dcf276
2 changed files with 24 additions and 62 deletions

View File

@ -18,8 +18,6 @@ sub defaultValues {
'authChoiceParam' => 'lmAuth',
'authentication' => 'Demo',
'browserIdAuthnLevel' => 1,
'captcha_login_enabled' => 0,
'captcha_mail_enabled' => 0,
'captcha_register_enabled' => 1,
'captcha_size' => 6,
'captchaStorage' => 'Apache::Session::File',
@ -29,7 +27,6 @@ sub defaultValues {
'CAS_authnLevel' => 1,
'CAS_pgtFile' => '/tmp/pgt.txt',
'casAccessControlPolicy' => 'none',
'cda' => 0,
'checkXSS' => 1,
'confirmFormMethod' => 'post',
'cookieName' => 'lemonldap',
@ -60,34 +57,25 @@ sub defaultValues {
'Lemonldap::NG::Common::Apache::Session::Generate::SHA256',
'LockDirectory' => '/var/lib/lemonldap-ng/sessions/lock/'
},
'groups' => {},
'hiddenAttributes' => '_password',
'hideOldPassword' => 0,
'httpOnly' => 1,
'https' => 0,
'infoFormMethod' => 'get',
'issuerDBCASActivation' => 0,
'issuerDBCASPath' => '^/cas/',
'issuerDBCASRule' => 1,
'issuerDBGetActivation' => 0,
'issuerDBGetParameters' => {},
'issuerDBGetPath' => '^/get/',
'issuerDBGetRule' => 1,
'issuerDBOpenIDActivation' => 0,
'issuerDBOpenIDConnectActivation' => 0,
'issuerDBOpenIDConnectPath' => '^/oauth2/',
'issuerDBOpenIDConnectRule' => 1,
'issuerDBOpenIDPath' => '^/openidserver/',
'issuerDBOpenIDRule' => 1,
'issuerDBSAMLActivation' => 0,
'issuerDBSAMLPath' => '^/saml/',
'issuerDBSAMLRule' => 1,
'jsRedirect' => 0,
'ldapAllowResetExpiredPassword' => 0,
'ldapAuthnLevel' => 2,
'ldapBase' => 'dc=example,dc=com',
'ldapChangePasswordAsUser' => 0,
'ldapExportedVars' => {
'groups' => {},
'hiddenAttributes' => '_password',
'httpOnly' => 1,
'infoFormMethod' => 'get',
'issuerDBCASPath' => '^/cas/',
'issuerDBCASRule' => 1,
'issuerDBGetParameters' => {},
'issuerDBGetPath' => '^/get/',
'issuerDBGetRule' => 1,
'issuerDBOpenIDConnectPath' => '^/oauth2/',
'issuerDBOpenIDConnectRule' => 1,
'issuerDBOpenIDPath' => '^/openidserver/',
'issuerDBOpenIDRule' => 1,
'issuerDBSAMLPath' => '^/saml/',
'issuerDBSAMLRule' => 1,
'jsRedirect' => 0,
'ldapAuthnLevel' => 2,
'ldapBase' => 'dc=example,dc=com',
'ldapExportedVars' => {
'cn' => 'cn',
'mail' => 'mail',
'uid' => 'uid'
@ -97,15 +85,12 @@ sub defaultValues {
'ldapGroupAttributeNameSearch' => 'cn',
'ldapGroupAttributeNameUser' => 'dn',
'ldapGroupObjectClass' => 'groupOfNames',
'ldapGroupRecursive' => 0,
'ldapPasswordResetAttribute' => 'pwdReset',
'ldapPasswordResetAttributeValue' => 'TRUE',
'ldapPort' => 389,
'ldapPpolicyControl' => 0,
'ldapPwdEnc' => 'utf-8',
'ldapSearchDeref' => 'find',
'ldapServer' => 'ldap://localhost',
'ldapSetPassword' => 0,
'ldapTimeout' => 120,
'ldapUsePasswordResetAttribute' => 1,
'ldapVersion' => 3,
@ -126,32 +111,24 @@ sub defaultValues {
'mailCharset' => 'utf-8',
'mailConfirmSubject' => '[LemonLDAP::NG] Password reset confirmation',
'mailFrom' => 'noreply@example.com',
'mailOnPasswordChange' => 0,
'mailSessionKey' => 'mail',
'mailSubject' => '[LemonLDAP::NG] Your new password',
'mailTimeout' => 0,
'mailUrl' => 'http://auth.example.com/mail.pl',
'maintenance' => 0,
'managerDn' => '',
'managerPassword' => '',
'multiValuesSeparator' => '; ',
'noAjaxHook' => 0,
'notification' => 0,
'notificationStorage' => 'File',
'notificationStorageOptions' => {
'dirName' => '/var/lib/lemonldap-ng/notifications'
},
'notificationWildcard' => 'allusers',
'notifyDeleted' => 1,
'notifyOther' => 0,
'nullAuthnLevel' => 2,
'oidcAuthnLevel' => 1,
'oidcRPCallbackGetParam' => 'openidconnectcallback',
'oidcRPStateTimeout' => 600,
'oidcServiceAllowAuthorizationCodeFlow' => 1,
'oidcServiceAllowDynamicRegistration' => 0,
'oidcServiceAllowHybridFlow' => 0,
'oidcServiceAllowImplicitFlow' => 0,
'oidcServiceMetaDataAuthnContext' => {
'loa-1' => 1,
'loa-2' => 2,
@ -185,16 +162,12 @@ sub defaultValues {
'portalDisplayLogout' => 1,
'portalDisplayRegister' => 1,
'portalDisplayResetPassword' => 1,
'portalForceAuthn' => 0,
'portalForceAuthnInterval' => 5,
'portalOpenLinkInNewWindow' => 0,
'portalPingInterval' => 60000,
'portalRequireOldPassword' => 1,
'portalSkin' => 'bootstrap',
'portalStatus' => 0,
'portalUserAttr' => '_user',
'proxyAuthnLevel' => 2,
'proxyUseSoap' => 0,
'radiusAuthnLevel' => 3,
'randomPasswordRegexp' => '[A-Z]{3}[a-z]{5}.\\d{2}',
'redirectFormMethod' => 'get',
@ -209,15 +182,12 @@ sub defaultValues {
'http://auth.example.com/Lemonldap/NG/Common/CGI/SOAPService',
'proxy' => 'http://auth.example.com/index.pl/sessions'
},
'restConfigServer' => 0,
'restSessionServer' => 0,
'samlAttributeAuthorityDescriptorAttributeServiceSOAP' =>
'urn:oasis:names:tc:SAML:2.0:bindings:SOAP;#PORTAL#/saml/AA/SOAP;',
'samlAuthnContextMapKerberos' => 4,
'samlAuthnContextMapPassword' => 2,
'samlAuthnContextMapPasswordProtectedTransport' => 3,
'samlAuthnContextMapTLSClient' => 5,
'samlCommonDomainCookieActivation' => 0,
'samlEntityID' => '#PORTAL#/saml/metadata',
'samlIdPResolveCookie' => 'lemonldapidp',
'samlIDPSSODescriptorArtifactResolutionServiceArtifact' =>
@ -242,9 +212,8 @@ sub defaultValues {
'samlNameIDFormatMapX509' => 'mail',
'samlOrganizationDisplayName' => 'Example',
'samlOrganizationName' => 'Example',
'samlOrganizationURL' => 'http://www.example.com',
'samlRelayStateTimeout' => 600,
'samlServiceUseCertificateInResponse' => 0,
'samlOrganizationURL' => 'http://www.example.com',
'samlRelayStateTimeout' => 600,
'samlSPSSODescriptorArtifactResolutionServiceArtifact' =>
'1;0;urn:oasis:names:tc:SAML:2.0:bindings:SOAP;#PORTAL#/saml/artifact',
'samlSPSSODescriptorAssertionConsumerServiceHTTPArtifact' =>
@ -259,7 +228,6 @@ sub defaultValues {
'samlSPSSODescriptorSingleLogoutServiceSOAP' =>
'urn:oasis:names:tc:SAML:2.0:bindings:SOAP;#PORTAL#/saml/proxySingleLogoutSOAP;',
'samlSPSSODescriptorWantAssertionsSigned' => 1,
'samlUseQueryStringSpecific' => 0,
'securedCookie' => 0,
'secureTokenAllowOnError' => 1,
'secureTokenAttribute' => 'uid',
@ -267,17 +235,10 @@ sub defaultValues {
'secureTokenHeader' => 'Auth-Token',
'secureTokenMemcachedServers' => '127.0.0.1:11211',
'secureTokenUrls' => '.*',
'singleIP' => 0,
'singleSession' => 0,
'singleSessionUserByIP' => 0,
'singleUserByIP' => 0,
'slaveAuthnLevel' => 2,
'slaveExportedVars' => {},
'SMTPServer' => '',
'soapConfigServer' => 0,
'soapSessionServer' => 0,
'SSLAuthnLevel' => 5,
'storePassword' => 0,
'successLoginNumber' => 5,
'syslog' => '',
'timeout' => 72000,
@ -288,7 +249,6 @@ sub defaultValues {
'userControl' => '^[\\w\\.\\-@]+$',
'userDB' => 'Demo',
'useRedirectOnError' => 1,
'useRedirectOnForbidden' => 0,
'useSafeJail' => 1,
'webIDAuthnLevel' => 1,
'webIDExportedVars' => {},

View File

@ -509,7 +509,9 @@ sub scanTree {
$jleaf->{$w} = $attr->{$w} if ( defined $attr->{$w} );
}
if ( defined $jleaf->{default} ) {
$defaultValues->{$leaf} = $jleaf->{default};
unless ( $attr->{type} eq 'bool' and $jleaf->{default} == 0 ) {
$defaultValues->{$leaf} = $jleaf->{default};
}
if ( ref( $jleaf->{default} ) ) {
$jleaf->{default} = [];
my $type = $attr->{type};