hpi-schul-cloud / schulcloud-server

@@ -15,7 +15,7 @@
Loading
15 15
 * @implements {Syncer}
16 16
 */
17 17
class LDAPSyncer extends Syncer {
18 -
	constructor(app, stats = {}, logger, system, options = {}) {
18 +
	constructor(app, stats = {}, logger, system, syncQueue, options = {}) {
19 19
		super(app, stats, logger);
20 20
		this.system = system;
21 21
		this.options = options;
@@ -24,7 +24,7 @@
Loading
24 24
			users: 0,
25 25
			classes: 0,
26 26
		});
27 -
		this.syncQueue = getChannel(LDAP_SYNC_CHANNEL_NAME, { durable: true });
27 +
		this.syncQueue = syncQueue;
28 28
		const systemId = this.system && this.system._id;
29 29
		this.ldapService = this.app && this.app.service('ldap');
30 30
		this.messageBuilder = new SyncMessageBuilder(this.syncId, systemId);

@@ -97,8 +97,9 @@
Loading
97 97
98 98
const updateUserAndAccount = async (userId, changedUser, changedAccount) => {
99 99
	await checkUpdate(changedUser.email, userId);
100 -
	changedUser.roles = await resolveUserRoles(changedUser.roles);
101 -
100 +
	if ('roles' in changedUser) {
101 +
		changedUser.roles = await resolveUserRoles(changedUser.roles);
102 +
	}
102 103
	const user = await userModel.findOneAndUpdate({ _id: userId }, changedUser, { new: true }).lean().exec();
103 104
	const account = await updateAccount(user._id, changedAccount);
104 105
	return { user, account };

@@ -2,6 +2,8 @@
Loading
2 2
const { Configuration } = require('@hpi-schul-cloud/commons');
3 3
const Syncer = require('./Syncer');
4 4
const { LDAPSyncer } = require('./LDAPSyncer');
5 +
const { getChannel } = require('../../../utils/rabbitmq');
6 +
const LDAP_SYNC_CHANNEL_NAME = Configuration.get('SYNC_QUEUE_NAME');
5 7
6 8
/**
7 9
 * Implements syncing from multiple LDAP servers based on the Syncer interface
@@ -15,6 +17,7 @@
Loading
15 17
		Object.assign(this.stats, {
16 18
			systems: {},
17 19
		});
20 +
		this.syncQueue = getChannel(LDAP_SYNC_CHANNEL_NAME, { durable: true });
18 21
	}
19 22
20 23
	/**
@@ -41,7 +44,7 @@
Loading
41 44
		const systems = await this.getSystems();
42 45
		const nextSystemSync = async (system) => {
43 46
			try {
44 -
				const stats = await new LDAPSyncer(this.app, {}, this.logger, system, this.options).sync();
47 +
				const stats = await new LDAPSyncer(this.app, {}, this.logger, system, this.syncQueue, this.options).sync();
45 48
				if (stats.success !== true) {
46 49
					this.stats.errors.push(`LDAP sync failed for system "${system.alias}" (${system._id}).`);
47 50
				}
Files Coverage
src 76.28%
Project Totals (520 files) 76.28%
1
coverage:
2
  precision: 2
3
  round: down
4
  range: "60...90"
5

6
  status:
7
    patch: no
8
    project:
9
      default:
10
        # basic
11
        target: auto
12
        threshold: 0.3
13
        base: auto
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading