[NEW] Option to remove users from RocketChat if not found in Crowd (#17619)

pull/15737/head
ocanema 5 years ago committed by GitHub
parent d1f2f22cba
commit 96552f4fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/crowd/server/crowd.js
  2. 1
      app/crowd/server/settings.js
  3. 1
      packages/rocketchat-i18n/i18n/en.i18n.json
  4. 3
      packages/rocketchat-i18n/i18n/it.i18n.json
  5. 1
      packages/rocketchat-i18n/i18n/pt-BR.i18n.json

@ -9,6 +9,7 @@ import { _setRealName } from '../../lib';
import { Users } from '../../models';
import { settings } from '../../settings';
import { hasRole } from '../../authorization';
import { deleteUser } from '../../lib/server/functions';
const logger = new Logger('CROWD', {});
@ -203,6 +204,13 @@ export class CROWD {
const response = self.crowdClient.searchSync('user', `email=" ${ email } "`);
if (!response || response.users.length === 0) {
logger.warn('Could not find user in CROWD with username or email:', crowd_username, email);
if (settings.get('CROWD_Remove_Orphaned_Users') === true) {
logger.info('Removing user:', crowd_username);
Meteor.defer(function() {
deleteUser(user._id);
logger.info('User removed:', crowd_username);
});
}
return;
}
crowd_username = response.users[0].name;

@ -14,6 +14,7 @@ Meteor.startup(function() {
this.add('CROWD_APP_PASSWORD', '', { type: 'password', enableQuery, i18nLabel: 'Password', secret: true });
this.add('CROWD_Sync_User_Data', false, { type: 'boolean', enableQuery, i18nLabel: 'Sync_Users' });
this.add('CROWD_Sync_Interval', 'Every 60 mins', { type: 'string', enableQuery: enableSyncQuery, i18nLabel: 'Sync_Interval', i18nDescription: 'Crowd_sync_interval_Description' });
this.add('CROWD_Remove_Orphaned_Users', false, { type: 'boolean', public: true, i18nLabel: 'Crowd_Remove_Orphaned_Users' });
this.add('CROWD_Clean_Usernames', true, { type: 'boolean', enableQuery, i18nLabel: 'Clean_Usernames', i18nDescription: 'Crowd_clean_usernames_Description' });
this.add('CROWD_Allow_Custom_Username', true, { type: 'boolean', i18nLabel: 'CROWD_Allow_Custom_Username' });
this.add('CROWD_Test_Connection', 'crowd_test_connection', { type: 'action', actionText: 'Test_Connection', i18nLabel: 'Test_Connection' });

@ -1045,6 +1045,7 @@
"CRM_Integration": "CRM Integration",
"CROWD_Allow_Custom_Username": "Allow custom username in Rocket.Chat",
"CROWD_Reject_Unauthorized": "Reject Unauthorized",
"Crowd_Remove_Orphaned_Users": "Remove Orphaned Users",
"Crowd_sync_interval_Description": "The interval between synchronizations. Example `every 24 hours` or `on the first day of the week`, more examples at [Cron Text Parser](http://bunkat.github.io/later/parsers.html#text)",
"Current_Chats": "Current Chats",
"Current_File": "Current File",

@ -831,6 +831,7 @@
"Created_at_s_by_s_triggered_by_s": "Creato alle <strong>%s</strong> da <strong>%s</strong> scatenato da <strong>%s</strong>",
"CRM_Integration": "Integrazione CRM",
"CROWD_Reject_Unauthorized": "Rifiuta non autorizzati",
"Crowd_Remove_Orphaned_Users": "Rimuovi utenti orfani",
"Crowd_sync_interval_Description": "L'intervallo tra le sincronizzazioni. Esempio \"ogni 24 ore\" o \"il primo giorno della settimana\", altri esempi su [Cron Text Parser] (http://bunkat.github.io/later/parsers.html#text)",
"Current_Chats": "Chat attuali",
"Current_Status": "Stato attuale",
@ -2888,4 +2889,4 @@
"Your_push_was_sent_to_s_devices": "La tua richiesta è stata inviata ai %s dispositivi.",
"Your_server_link": "Il tuo collegamento al server",
"Your_workspace_is_ready": "Il tuo spazio di lavoro è pronto per l'uso 🎉"
}
}

@ -1000,6 +1000,7 @@
"CRM_Integration": "Integração de CRM",
"CROWD_Allow_Custom_Username": "Permitir nome de usuário personalizado no Rocket.Chat",
"CROWD_Reject_Unauthorized": "Rejeitar não autorizado",
"Crowd_Remove_Orphaned_Users": "Remover usuários órfãos",
"Crowd_sync_interval_Description": "O intervalo entre as sincronizações. Exemplo de \"todas as 24 horas\" ou \"no primeiro dia da semana\", mais exemplos em [Cron Text Parser] (http://bunkat.github.io/later/parsers.html#text)",
"Current_Chats": "Bate-papos atuais",
"Current_File": "Arquivo atual",

Loading…
Cancel
Save