From 87039fa784b2382a8710a167854cdee2f5bbf389 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 27 Apr 2018 22:35:32 -0400 Subject: [PATCH] conditional settings for ldap ad --- src/app/tabs/settings.component.html | 112 ++++++++++++++------------ src/app/tabs/settings.component.ts | 8 ++ src/locales/en/messages.json | 13 ++- src/services/configuration.service.ts | 2 +- 4 files changed, 74 insertions(+), 61 deletions(-) diff --git a/src/app/tabs/settings.component.html b/src/app/tabs/settings.component.html index c1262681..f925b6d6 100644 --- a/src/app/tabs/settings.component.html +++ b/src/app/tabs/settings.component.html @@ -100,42 +100,46 @@ -
- - -
-
- - -
-
- - -
+
+
+ + +
+
+
+ + +
+
+ + +
+
-
-
- - -
-
-
- - +
+ + +
-
- - +
+
+ + +
+
+ + +
@@ -150,18 +154,20 @@
-
- - -
-
- - -
-
- - +
+
+ + +
+
+ + +
+
+ + +
@@ -176,19 +182,21 @@
-
- - -
-
- - -
-
- - +
+
+ + +
+
+ + +
+
+ + +
diff --git a/src/app/tabs/settings.component.ts b/src/app/tabs/settings.component.ts index d158f97e..9364dd7c 100644 --- a/src/app/tabs/settings.component.ts +++ b/src/app/tabs/settings.component.ts @@ -56,6 +56,14 @@ export class SettingsComponent implements OnInit { } async submit() { + if (this.ldap.ad) { + this.sync.creationDateAttribute = 'whenCreated'; + this.sync.revisionDateAttribute = 'whenChanged'; + this.sync.emailPrefixAttribute = 'sAMAccountName'; + this.sync.groupPath = 'CN=Users'; + this.sync.userPath = 'CN=Users'; + } + await this.configurationService.saveDirectoryType(this.directory); await this.configurationService.saveDirectory(DirectoryType.Ldap, this.ldap); await this.configurationService.saveDirectory(DirectoryType.GSuite, this.gsuite); diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 761af30f..980c76c6 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -321,9 +321,6 @@ "password": { "message": "Password" }, - "thisIsActiveDirectory": { - "message": "This is an Active Directory LDAP server." - }, "type": { "message": "Type" }, @@ -331,7 +328,7 @@ "message": "Directory" }, "currentUser": { - "message": "Authenticate as current user" + "message": "Authenticate as current system user" }, "rootPath": { "message": "Root Path" @@ -364,7 +361,7 @@ "message": "Interval (in minutes)" }, "removeDisabled": { - "message": "Remove disabled users" + "message": "Remove disabled users during sync" }, "memberAttribute": { "message": "Member Attribute" @@ -376,7 +373,7 @@ "message": "Revision Date Attribute" }, "useEmailPrefixSuffix": { - "message": "Use email prefix/suffix" + "message": "If a user has no email address, combine a username prefix with a suffix value to form an email" }, "emailPrefixAttribute": { "message": "Email Prefix Attribute" @@ -418,10 +415,10 @@ "message": "Sync" }, "ldapSsl": { - "message": "This connection uses SSL (LDAPS)" + "message": "This server uses SSL (LDAPS)" }, "ldapAd": { - "message": "This LDAP server is Active Directory" + "message": "This server uses Active Directory" }, "select": { "message": "Select" diff --git a/src/services/configuration.service.ts b/src/services/configuration.service.ts index 80e93db4..b100d0c7 100644 --- a/src/services/configuration.service.ts +++ b/src/services/configuration.service.ts @@ -63,7 +63,7 @@ export class ConfigurationService { if (savedConfig.privateKey == null) { await this.secureStorageService.remove(Keys.gsuite); } else { - (config as any).privateKey = savedConfig.privateKey = + (config as GSuiteConfiguration).privateKey = savedConfig.privateKey = savedConfig.privateKey.replace(/\\n/g, '\n'); await this.secureStorageService.save(Keys.gsuite, savedConfig.privateKey); savedConfig.privateKey = StoredSecurely;