Skip to content

Commit

Permalink
feat(dashboard): add ldapUserDomain input and validation for local LD…
Browse files Browse the repository at this point in the history
…AP configuration
  • Loading branch information
stephdl committed Nov 20, 2024
1 parent dcab426 commit 4da15f8
Showing 1 changed file with 51 additions and 7 deletions.
58 changes: 51 additions & 7 deletions ui/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,39 @@
/>
</div>
</div>
<!-- ldap_userdomain -->
<div v-if="isLdapEnabled && accountProviderConfig.location == 'local' && accountProviderConfig.type == 'ldap'">
<div
class="alert alert-info alert-dismissable"
>
<span class="pficon pficon-info"></span>
<strong
>{{
$t("dashboard.ldap_user_domain_info")
}}:</strong
>
{{
$t("dashboard.ldap_user_domain_description")
}}
</div>
<div :class="['form-group', { 'has-error': error.ldapUserDomain }]">
<label class="col-sm-2 control-label" for="ldap-userdomain">{{
$t("dashboard.ldap_user_domain")
}}</label>
<div class="col-sm-5">
<input
type="text"
v-model="config.ldapUserDomain"
id="ldap-userdomain"
ref="ldapUserDomain"
class="form-control"
/>
<span v-if="error.ldapUserDomain" class="help-block">{{
$t("validation.ldap_user_domain_" + error.ldapUserDomain)
}}</span>
</div>
</div>
</div>
<!-- connect button -->
<div class="form-group">
<label class="col-sm-2 control-label">
Expand Down Expand Up @@ -1088,8 +1121,10 @@ export default {
tlsVerify: false,
leaderNode: "",
adminUsername: "",
adminPassword: ""
adminPassword: "",
ldapUserDomain: "",
},
isLdapEnabled: false,
installedApps: [],
apps: [],
currentApp: null,
Expand Down Expand Up @@ -1143,7 +1178,8 @@ export default {
ctiVirtualHost: "",
sogoVirtualHost: "",
webtopVirtualHost: "",
userDomains: ""
userDomains: "",
ldapUserDomain: "",
}
};
},
Expand Down Expand Up @@ -1201,7 +1237,9 @@ export default {
}
},
mounted() {
this.connectionRead();
// get connection info we need to retrieve the account provider info first
// to check if it's local or remote and ldap or ad
this.getAccountProviderInfo();
},
methods: {
togglePassword() {
Expand Down Expand Up @@ -1463,15 +1501,16 @@ export default {
},
connectionReadSuccess(output) {
const ns8Config = output.configuration.ns8.props;
const slapd = output.configuration.slapd.props;
this.config.isConnected = ns8Config.Host != "";
this.config.leaderNode = ns8Config.Host;
this.config.adminUsername = ns8Config.User;
this.config.adminPassword = ns8Config.Password;
this.config.tlsVerify = ns8Config.TLSVerify == "enabled";
this.loading.connectionRead = false;
this.isLdapEnabled = slapd.status === "enabled";
if (this.config.isConnected) {
this.getAccountProviderInfo();
this.listApplications();
} else {
this.$nextTick(() => {
this.$refs.leaderNode.focus();
Expand All @@ -1482,6 +1521,7 @@ export default {
this.error.leaderNode = "";
this.error.adminUsername = "";
this.error.adminPassword = "";
this.error.ldapUserDomain = "";
this.error.leaderNode = "";
this.loading.connectionUpdate = true;
this.error.connectionUpdate = "";
Expand All @@ -1492,7 +1532,8 @@ export default {
Host: this.config.leaderNode,
User: this.config.adminUsername,
Password: this.config.adminPassword,
TLSVerify: this.config.tlsVerify ? "enabled" : "disabled"
TLSVerify: this.config.tlsVerify ? "enabled" : "disabled",
LdapUserDomain: this.config.ldapUserDomain
};
const context = this;
Expand Down Expand Up @@ -1530,6 +1571,9 @@ export default {
} else if (param === "Password") {
this.error.adminPassword = attr.error;
this.$refs.adminPassword.focus();
} else if (param === "LdapUserDomain") {
this.error.ldapUserDomain = attr.error;
this.$refs.ldapUserDomain.focus();
}
}
},
Expand Down Expand Up @@ -1856,7 +1900,7 @@ export default {
accountProviderConfig.location = location;
context.accountProviderConfig = accountProviderConfig;
context.loading.accountProviderInfo = false;
context.listApplications();
context.connectionRead();
},
function (error) {
const errorMessage = context.$i18n.t(
Expand Down

0 comments on commit 4da15f8

Please sign in to comment.