The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-ldap/server/syncUsers.js

29 lines
620 B

/* globals sync */
Meteor.methods({
ldap_sync_users: function() {
const user = Meteor.user();
if (!user) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'ldap_sync_users' });
}
if (!RocketChat.authz.hasRole(user._id, 'admin')) {
throw new Meteor.Error('error-not-authorized', 'Not authorized', { method: 'ldap_sync_users' });
}
if (RocketChat.settings.get('LDAP_Enable') !== true) {
throw new Meteor.Error('LDAP_disabled');
}
const result = sync();
if (result === true) {
return {
message: 'Sync_success',
params: []
};
}
throw result;
}
});