Skip to content

Commit

Permalink
Remove console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
Gijsdeman committed Dec 1, 2023
1 parent 6439af5 commit 074d1fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ async function synchronizeUserACL(activeDirectoryUser: ActiveDirectoryUser, perm
attributes: ['memberFlattened'],
})).searchEntries[0] as unknown as ActiveDirectoryUser;

console.log('CHECKING');
console.log(activeDirectoryUser);

await updateLocalUserPermissions(activeDirectoryUser.mail, activeDirectoryPermissionGroup.memberFlattened, permission)
.then(async (changedUsers: ChangedUsers) => {
if (changedUsers.newUsers.length != 0) {
Expand Down Expand Up @@ -357,13 +354,17 @@ async function synchronizeUsersWithActiveDirectory(): Promise<void> {
const localUser: LocalUserData = await getLocalUser(mail);
const mailcowUser: MailcowUserData = await getMailcowUser(mail);

console.log('start checking local user');

if (!localUser.exists) {
console.log(`Adding local user ${mail} (active: ${isActive})`);
await createLocalUser(mail, displayName, isActive);
localUser.exists = true;
localUser.isActive = isActive;
}

console.log('start checking mailcow user');

if (!mailcowUser.exists) {
console.log(`Adding Mailcow user ${mail} (active: ${isActive})`);
await createMailcowUser(mail, displayName, isActive, 256);
Expand All @@ -372,21 +373,29 @@ async function synchronizeUsersWithActiveDirectory(): Promise<void> {
mailcowUser.displayName = displayName;
}

console.log('start checking local user active');

if (localUser.isActive !== isActive) {
console.log(`Set ${mail} to active state ${isActive} in local user database`);
await updateLocalUserActivity(mail, isActive, 0);
}

console.log('start checking mailcow user active');

if (mailcowUser.isActive !== isActive) {
console.log(`Set ${mail} to active state ${isActive} in Mailcow`);
await editMailcowUser(mail, { active: isActive });
}

console.log('start checking mailcow displayname');

if (mailcowUser.displayName !== displayName) {
console.log(`Changed displayname for ${mail} to ${displayName} in Mailcow`);
await editMailcowUser(mail, { name: displayName });
}

console.log('start checking loal displayname');

if (localUser.displayName !== displayName) {
console.log(`Changed displayname for ${mail} to ${displayName} in local database`);
await editLocalUserDisplayName(mail, displayName);
Expand Down
1 change: 1 addition & 0 deletions src/mailcowDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export async function editUserSignatures(user: Users, SOBs: string[]): Promise<v
let defaultSettings: Defaults = JSON.parse(userProfile.c_defaults);
let newIdentities: SOGoMailIdentity[] = [];

console.log(defaultSettings.SOGoMailIdentities);
for (let identity of defaultSettings.SOGoMailIdentities) {
if (identity.signature.indexOf('class="autogenerated"') === -1) {
newIdentities.push(identity);
Expand Down

0 comments on commit 074d1fc

Please sign in to comment.