|
@@ -21,11 +21,11 @@ const validator = {
|
|
|
body('pageCompleteDeletionAuthority').isString().isIn([
|
|
body('pageCompleteDeletionAuthority').isString().isIn([
|
|
|
'anyOne', 'adminOnly', 'adminAndAuthor',
|
|
'anyOne', 'adminOnly', 'adminAndAuthor',
|
|
|
]),
|
|
]),
|
|
|
- body('hideRestrictedByOwner').isBoolean(),
|
|
|
|
|
- body('hideRestrictedByGroup').isBoolean(),
|
|
|
|
|
|
|
+ body('hideRestrictedByOwner').if((value, { req }) => req.body.hideRestrictedByOwner).isBoolean(),
|
|
|
|
|
+ body('hideRestrictedByGroup').if((value, { req }) => req.body.hideRestrictedByGroup).isBoolean(),
|
|
|
],
|
|
],
|
|
|
authenticationSetting: [
|
|
authenticationSetting: [
|
|
|
- body('isEnabled').isBoolean(),
|
|
|
|
|
|
|
+ body('isEnabled').if((value, { req }) => req.body.isEnabled).isBoolean(),
|
|
|
body('authId').isString().isIn([
|
|
body('authId').isString().isIn([
|
|
|
'local', 'ldap', 'saml', 'oidc', 'basic', 'google', 'github', 'twitter',
|
|
'local', 'ldap', 'saml', 'oidc', 'basic', 'google', 'github', 'twitter',
|
|
|
]),
|
|
]),
|
|
@@ -34,57 +34,57 @@ const validator = {
|
|
|
body('registrationMode').isString().isIn([
|
|
body('registrationMode').isString().isIn([
|
|
|
'Open', 'Restricted', 'Closed',
|
|
'Open', 'Restricted', 'Closed',
|
|
|
]),
|
|
]),
|
|
|
- body('registrationWhiteList').isArray(),
|
|
|
|
|
|
|
+ body('registrationWhiteList').if((value, { req }) => req.body.registrationWhiteList).isArray(),
|
|
|
],
|
|
],
|
|
|
ldapAuth: [
|
|
ldapAuth: [
|
|
|
- body('serverUrl').isString(),
|
|
|
|
|
- body('isUserBind').isBoolean(),
|
|
|
|
|
- body('ldapBindDN').isString(),
|
|
|
|
|
- body('ldapBindDNPassword').isString(),
|
|
|
|
|
- body('ldapSearchFilter').isString(),
|
|
|
|
|
- body('ldapAttrMapUsername').isString(),
|
|
|
|
|
- body('isSameUsernameTreatedAsIdenticalUser').isBoolean(),
|
|
|
|
|
- body('ldapAttrMapMail').isString(),
|
|
|
|
|
- body('ldapAttrMapName').isString(),
|
|
|
|
|
- body('ldapGroupSearchBase').isString(),
|
|
|
|
|
- body('ldapGroupSearchFilter').isString(),
|
|
|
|
|
- body('ldapGroupDnProperty').isString(),
|
|
|
|
|
|
|
+ body('serverUrl').if((value, { req }) => req.body.serverUrl).isString(),
|
|
|
|
|
+ body('isUserBind').if((value, { req }) => req.body.isUserBind).isBoolean(),
|
|
|
|
|
+ body('ldapBindDN').if((value, { req }) => req.body.ldapBindDN).isString(),
|
|
|
|
|
+ body('ldapBindDNPassword').if((value, { req }) => req.body.ldapBindDNPassword).isString(),
|
|
|
|
|
+ body('ldapSearchFilter').if((value, { req }) => req.body.ldapSearchFilter).isString(),
|
|
|
|
|
+ body('ldapAttrMapUsername').if((value, { req }) => req.body.ldapAttrMapUsername).isString(),
|
|
|
|
|
+ body('isSameUsernameTreatedAsIdenticalUser').if((value, { req }) => req.body.isSameUsernameTreatedAsIdenticalUser).isBoolean(),
|
|
|
|
|
+ body('ldapAttrMapMail').if((value, { req }) => req.body.ldapAttrMapMail).isString(),
|
|
|
|
|
+ body('ldapAttrMapName').if((value, { req }) => req.body.ldapAttrMapName).isString(),
|
|
|
|
|
+ body('ldapGroupSearchBase').if((value, { req }) => req.body.ldapGroupSearchBase).isString(),
|
|
|
|
|
+ body('ldapGroupSearchFilter').if((value, { req }) => req.body.ldapGroupSearchFilter).isString(),
|
|
|
|
|
+ body('ldapGroupDnProperty').if((value, { req }) => req.body.ldapGroupDnProperty).isString(),
|
|
|
],
|
|
],
|
|
|
samlAuth: [
|
|
samlAuth: [
|
|
|
- body('samlEntryPoint').isString(),
|
|
|
|
|
- body('samlIssuer').isString(),
|
|
|
|
|
- body('samlCert').isString(),
|
|
|
|
|
- body('samlAttrMapId').isString(),
|
|
|
|
|
- body('samlAttrMapUserName').isString(),
|
|
|
|
|
- body('samlAttrMapMail').isString(),
|
|
|
|
|
- body('samlAttrMapFirstName').isString(),
|
|
|
|
|
- body('samlAttrMapLastName').isString(),
|
|
|
|
|
- body('isSameUsernameTreatedAsIdenticalUser').isBoolean(),
|
|
|
|
|
- body('isSameEmailTreatedAsIdenticalUser').isBoolean(),
|
|
|
|
|
|
|
+ body('samlEntryPoint').if((value, { req }) => req.body.samlEntryPoint).isString(),
|
|
|
|
|
+ body('samlIssuer').if((value, { req }) => req.body.samlIssuer).isString(),
|
|
|
|
|
+ body('samlCert').if((value, { req }) => req.body.samlCert).isString(),
|
|
|
|
|
+ body('samlAttrMapId').if((value, { req }) => req.body.samlAttrMapId).isString(),
|
|
|
|
|
+ body('samlAttrMapUserName').if((value, { req }) => req.body.samlAttrMapUserName).isString(),
|
|
|
|
|
+ body('samlAttrMapMail').if((value, { req }) => req.body.samlAttrMapMail).isString(),
|
|
|
|
|
+ body('samlAttrMapFirstName').if((value, { req }) => req.body.samlAttrMapFirstName).isString(),
|
|
|
|
|
+ body('samlAttrMapLastName').if((value, { req }) => req.body.samlAttrMapLastName).isString(),
|
|
|
|
|
+ body('isSameUsernameTreatedAsIdenticalUser').if((value, { req }) => req.body.isSameUsernameTreatedAsIdenticalUser).isBoolean(),
|
|
|
|
|
+ body('isSameEmailTreatedAsIdenticalUser').if((value, { req }) => req.body.isSameEmailTreatedAsIdenticalUser).isBoolean(),
|
|
|
],
|
|
],
|
|
|
oidcAuth: [
|
|
oidcAuth: [
|
|
|
- body('oidcProviderName').isString(),
|
|
|
|
|
- body('oidcIssuerHost').isString(),
|
|
|
|
|
- body('oidcClientId').isString(),
|
|
|
|
|
- body('oidcClientSecret').isString(),
|
|
|
|
|
- body('oidcAttrMapId').isString(),
|
|
|
|
|
- body('oidcAttrMapUserName').isString(),
|
|
|
|
|
- body('oidcAttrMapEmail').isString(),
|
|
|
|
|
- body('isSameUsernameTreatedAsIdenticalUser').isBoolean(),
|
|
|
|
|
- body('isSameEmailTreatedAsIdenticalUser').isBoolean(),
|
|
|
|
|
|
|
+ body('oidcProviderName').if((value, { req }) => req.body.oidcProviderName).isString(),
|
|
|
|
|
+ body('oidcIssuerHost').if((value, { req }) => req.body.oidcIssuerHost).isString(),
|
|
|
|
|
+ body('oidcClientId').if((value, { req }) => req.body.oidcClientId).isString(),
|
|
|
|
|
+ body('oidcClientSecret').if((value, { req }) => req.body.oidcClientSecret).isString(),
|
|
|
|
|
+ body('oidcAttrMapId').if((value, { req }) => req.body.oidcAttrMapId).isString(),
|
|
|
|
|
+ body('oidcAttrMapUserName').if((value, { req }) => req.body.oidcAttrMapUserName).isString(),
|
|
|
|
|
+ body('oidcAttrMapEmail').if((value, { req }) => req.body.oidcAttrMapEmail).isString(),
|
|
|
|
|
+ body('isSameUsernameTreatedAsIdenticalUser').if((value, { req }) => req.body.isSameUsernameTreatedAsIdenticalUser).isBoolean(),
|
|
|
|
|
+ body('isSameEmailTreatedAsIdenticalUser').if((value, { req }) => req.body.isSameEmailTreatedAsIdenticalUser).isBoolean(),
|
|
|
],
|
|
],
|
|
|
basicAuth: [
|
|
basicAuth: [
|
|
|
- body('isSameUsernameTreatedAsIdenticalUser').isBoolean(),
|
|
|
|
|
|
|
+ body('isSameUsernameTreatedAsIdenticalUser').if((value, { req }) => req.body.isSameUsernameTreatedAsIdenticalUser).isBoolean(),
|
|
|
],
|
|
],
|
|
|
googleOAuth: [
|
|
googleOAuth: [
|
|
|
- body('googleClientId').isString(),
|
|
|
|
|
- body('googleClientSecret').isString(),
|
|
|
|
|
- body('isSameUsernameTreatedAsIdenticalUser').isBoolean(),
|
|
|
|
|
|
|
+ body('googleClientId').if((value, { req }) => req.body.googleClientId).isString(),
|
|
|
|
|
+ body('googleClientSecret').if((value, { req }) => req.body.googleClientSecret).isString(),
|
|
|
|
|
+ body('isSameUsernameTreatedAsIdenticalUser').if((value, { req }) => req.body.isSameUsernameTreatedAsIdenticalUser).isBoolean(),
|
|
|
],
|
|
],
|
|
|
githubOAuth: [
|
|
githubOAuth: [
|
|
|
- body('githubClientId').isString(),
|
|
|
|
|
- body('githubClientSecret').isString(),
|
|
|
|
|
- body('isSameUsernameTreatedAsIdenticalUser').isBoolean(),
|
|
|
|
|
|
|
+ body('githubClientId').if((value, { req }) => req.body.githubClientId).isString(),
|
|
|
|
|
+ body('githubClientSecret').if((value, { req }) => req.body.githubClientSecret).isString(),
|
|
|
|
|
+ body('isSameUsernameTreatedAsIdenticalUser').if((value, { req }) => req.body.isSameUsernameTreatedAsIdenticalUser).isBoolean(),
|
|
|
],
|
|
],
|
|
|
twitterOAuth: [
|
|
twitterOAuth: [
|
|
|
body('twitterConsumerKey').if((value, { req }) => req.body.twitterConsumerKey).isString(),
|
|
body('twitterConsumerKey').if((value, { req }) => req.body.twitterConsumerKey).isString(),
|