mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
- Add missing [wekan-ldap#40](https://github.com/wekan/wekan-ldap/pull/40) code about LDAP_SYNC_ADMIN_STATUS.
Thanks to JulianJacobi, n-st, chirrut2 and xet7 ! Closes #2351
This commit is contained in:
parent
0765278195
commit
0fe40ad9ec
1 changed files with 18 additions and 0 deletions
|
@ -179,6 +179,15 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
|
|||
},
|
||||
};
|
||||
|
||||
if (LDAP.settings_get('LDAP_SYNC_ADMIN_STATUS') === true) {
|
||||
log_debug('Updating admin status');
|
||||
const targetGroups = LDAP.settings_get('LDAP_SYNC_ADMIN_GROUPS').split(',');
|
||||
const groups = ldap.getUserGroups(username, ldapUser).filter((value) => targetGroups.includes(value));
|
||||
|
||||
user.isAdmin = groups.length > 0;
|
||||
Meteor.users.update({_id: user._id}, {$set: {isAdmin: user.isAdmin}});
|
||||
}
|
||||
|
||||
if( LDAP.settings_get('LDAP_SYNC_GROUP_ROLES') === true ) {
|
||||
log_debug('Updating Groups/Roles');
|
||||
const groups = ldap.getUserGroups(username, ldapUser);
|
||||
|
@ -217,6 +226,15 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
|
|||
|
||||
const result = addLdapUser(ldapUser, username, loginRequest.ldapPass);
|
||||
|
||||
if (LDAP.settings_get('LDAP_SYNC_ADMIN_STATUS') === true) {
|
||||
log_debug('Updating admin status');
|
||||
const targetGroups = LDAP.settings_get('LDAP_SYNC_ADMIN_GROUPS').split(',');
|
||||
const groups = ldap.getUserGroups(username, ldapUser).filter((value) => targetGroups.includes(value));
|
||||
|
||||
result.isAdmin = groups.length > 0;
|
||||
Meteor.users.update({_id: result.userId}, {$set: {isAdmin: result.isAdmin}});
|
||||
}
|
||||
|
||||
if( LDAP.settings_get('LDAP_SYNC_GROUP_ROLES') === true ) {
|
||||
const groups = ldap.getUserGroups(username, ldapUser);
|
||||
if( groups.length > 0 ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue