@@ -477,6 +477,9 @@ const user = {
477477 commit ( 'SET_NAME' , result . firstname + ' ' + result . lastname )
478478 commit ( 'SET_AVATAR' , result . icon ?. base64image || '' )
479479 store . dispatch ( 'SetCsLatestVersion' , result . rolename )
480+ store . dispatch ( 'UpdateConfiguration' ) . catch ( error => {
481+ reject ( error )
482+ } )
480483 } ) . catch ( error => {
481484 reject ( error )
482485 } )
@@ -490,13 +493,6 @@ const user = {
490493 } ) . catch ( ignored => {
491494 } )
492495
493- getAPI ( 'listLdapConfigurations' ) . then ( response => {
494- const ldapEnable = ( response . ldapconfigurationresponse . count > 0 )
495- commit ( 'SET_LDAP' , ldapEnable )
496- } ) . catch ( error => {
497- reject ( error )
498- } )
499-
500496 getAPI ( 'cloudianIsEnabled' ) . then ( response => {
501497 const cloudian = response . cloudianisenabledresponse . cloudianisenabled || { }
502498 commit ( 'SET_CLOUDIAN' , cloudian )
@@ -626,13 +622,15 @@ const user = {
626622 } )
627623 } ,
628624 UpdateConfiguration ( { commit } ) {
629- return new Promise ( ( resolve , reject ) => {
630- getAPI ( 'listLdapConfigurations' ) . then ( response => {
631- const ldapEnable = ( response . ldapconfigurationresponse . count > 0 )
632- commit ( 'SET_LDAP' , ldapEnable )
633- } ) . catch ( error => {
634- reject ( error )
635- } )
625+ // Root admins see LDAP as enabled if any configuration exists; everyone else
626+ // only when a global configuration or one linked to their own domain exists
627+ const userInfo = store . getters . userInfo
628+ const queries = userInfo . roletype === 'Admin'
629+ ? [ { listall : true } ]
630+ : [ { } , { domainid : userInfo . domainid } ]
631+ return Promise . all ( queries . map ( params => getAPI ( 'listLdapConfigurations' , params ) ) ) . then ( responses => {
632+ const ldapEnable = responses . some ( response => response . ldapconfigurationresponse . count > 0 )
633+ commit ( 'SET_LDAP' , ldapEnable )
636634 } )
637635 } ,
638636 SetDomainStore ( { commit } , domainStore ) {
0 commit comments