Skip to content

Commit

Permalink
Merge pull request #96 from NethServer/sdl-7103-placeholder
Browse files Browse the repository at this point in the history
Include LDAP user domain in connection configuration NethServer/dev#7103
  • Loading branch information
stephdl authored Dec 6, 2024
2 parents fa8d0dd + a1e5fe3 commit 0fb792d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
6 changes: 5 additions & 1 deletion api/connection/read
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def get_config():
process = subprocess.Popen(bash_command.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
ns8_config = simplejson.loads(output)
props = {"ns8": ns8_config, "slapd": {"props":{"status": "disabled"}}}
bash_command = "/sbin/e-smith/config printjson DomainName"
process = subprocess.Popen(bash_command.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
domain_name = simplejson.loads(output)
props = {"ns8": ns8_config,"account_provider_proposal": domain_name['type'], "slapd": {"props":{"status": "disabled"}}}

# slapd config
if os.path.isfile('/etc/e-smith/db/configuration/defaults/slapd/type'):
Expand Down
2 changes: 1 addition & 1 deletion ui/public/i18n/language.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"error_on_skip": "There was an error when changing the skip flag.",
"app_migrated_with_ad": "This app is migrated together with Local Active Directory app",
"enable_forge_sogo": "To successfully migrate SOGo, ensure NethForge repository is enabled under NS8 Settings",
"ldap_user_domain_description": "This machine uses a local OpenLDAP account provider. You must choose a new name for the domain, something like ldap.domain.tld. The name must be unique inside the NethServer 8 cluster",
"ldap_user_domain_description": "Enter a unique domain name for OpenLDAP migration within the NS8 cluster.",
"ldap_user_domain": "LDAP user domain",
"error_domain_exists": "The domain '{domain}' already exists in the NS8 cluster. Please choose a different domain name",
"error_unauthorized": "Access denied. Please verify your credentials.",
Expand Down
38 changes: 27 additions & 11 deletions ui/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,33 @@
{{ $t("dashboard.connect_description") }}
</div>
<form class="form-horizontal" v-on:submit.prevent="connectionValidate">
<!-- ldap_userdomain -->
<div v-if="isLdapEnabled && accountProviderConfig.location == 'local' && accountProviderConfig.type == 'ldap'">
<div
class="alert alert-info alert-dismissable"
>
<!-- 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>
{{
$t("dashboard.ldap_user_domain_description")
}}
{{ $t("dashboard.ldap_user_domain_description") }}
</div>
</div>
<div v-if="isLdapEnabled && accountProviderConfig.location == 'local' && accountProviderConfig.type == 'ldap'">
<div :class="['form-group', { 'has-error': error.ldapUserDomain }, 'mg-bottom-40']">
<div
v-if="
isLdapEnabled &&
accountProviderConfig.location == 'local' &&
accountProviderConfig.type == 'ldap'
"
>
<div
:class="[
'form-group',
{ 'has-error': error.ldapUserDomain },
'mg-bottom-40',
]"
>
<label class="col-sm-2 control-label" for="ldap-userdomain">{{
$t("dashboard.ldap_user_domain")
}}</label>
Expand All @@ -86,7 +100,7 @@
$t("validation.ldap_user_domain_" + error.ldapUserDomain)
}}</span>
</div>
</div>
</div>
</div>
<!-- leader node -->
<div :class="['form-group', { 'has-error': error.leaderNode }]">
Expand Down Expand Up @@ -1500,10 +1514,12 @@ export default {
connectionReadSuccess(output) {
const ns8Config = output.configuration.ns8.props;
const slapd = output.configuration.slapd.props;
const account_provider_proposal = output.configuration.account_provider_proposal;
this.config.isConnected = ns8Config.Host != "";
this.config.leaderNode = ns8Config.Host;
this.config.adminUsername = ns8Config.User;
this.config.adminPassword = ns8Config.Password;
this.config.ldapUserDomain = account_provider_proposal;
this.config.tlsVerify = ns8Config.TLSVerify == "enabled";
this.loading.connectionRead = false;
this.isLdapEnabled = slapd.status === "enabled";
Expand Down

0 comments on commit 0fb792d

Please sign in to comment.