mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
PRovide LDAP sync and authentication
This commit is contained in:
parent
63b17f9b88
commit
074eea3aeb
38 changed files with 567 additions and 499 deletions
|
@ -129,6 +129,7 @@ export default Component.extend(ModalMixin, Notifier, {
|
|||
if (is.undefined(ldapConfig) || is.null(ldapConfig) || is.empty(ldapConfig) ) {
|
||||
ldapConfig = {};
|
||||
} else {
|
||||
ldapConfig = JSON.parse(ldapConfig);
|
||||
ldapConfig.defaultPermissionAddSpace = ldapConfig.hasOwnProperty('defaultPermissionAddSpace') ? ldapConfig.defaultPermissionAddSpace : false;
|
||||
ldapConfig.disableLogout = ldapConfig.hasOwnProperty('disableLogout') ? ldapConfig.disableLogout : true;
|
||||
}
|
||||
|
@ -240,19 +241,43 @@ export default Component.extend(ModalMixin, Notifier, {
|
|||
config = copy(this.get('ldapConfig'));
|
||||
config.serverHost = config.serverHost.trim();
|
||||
config.serverPort = parseInt(this.get('ldapConfig.serverPort'));
|
||||
|
||||
if (is.not.empty(config.groupFilter) && is.empty(config.attributeGroupMember)) {
|
||||
this.$('#ldap-attributeGroupMember').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
debugger;
|
||||
|
||||
this.showWait();
|
||||
|
||||
let data = { authProvider: provider, authConfig: JSON.stringify(config) };
|
||||
|
||||
this.get('onSave')(data).then(() => {
|
||||
// Without sync we cannot log in
|
||||
|
||||
// Keycloak sync process
|
||||
if (data.authProvider === constants.AuthProvider.Keycloak) {
|
||||
this.get('onSync')().then((response) => {
|
||||
this.get('onSyncKeycloak')().then((response) => {
|
||||
if (response.isError) {
|
||||
this.set('keycloakFailure', response.message);
|
||||
console.log(response.message); // eslint-disable-line no-console
|
||||
data.authProvider = constants.AuthProvider.Documize;
|
||||
this.get('onSave')(data).then(() => {});
|
||||
} else {
|
||||
if (data.authProvider === this.get('appMeta.authProvider')) {
|
||||
console.log(response.message); // eslint-disable-line no-console
|
||||
} else {
|
||||
this.get('onChange')(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// LDAP sync process
|
||||
if (data.authProvider === constants.AuthProvider.LDAP) {
|
||||
this.get('onSyncLDAP')().then((response) => {
|
||||
if (response.isError) {
|
||||
this.set('keycloakFailure', response.message);
|
||||
console.log(response.message); // eslint-disable-line no-console
|
||||
|
|
|
@ -240,8 +240,12 @@ export default Component.extend(AuthProvider, ModalMixin, TooltipMixin, {
|
|||
});
|
||||
},
|
||||
|
||||
onSync() {
|
||||
this.get('onSync')();
|
||||
onSyncKeycloak() {
|
||||
this.get('onSyncKeycloak')();
|
||||
},
|
||||
|
||||
onSyncLDAP() {
|
||||
this.get('onSyncLDAP')();
|
||||
},
|
||||
|
||||
onLimit(limit) {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
import $ from 'jquery';
|
||||
import { empty, and } from '@ember/object/computed';
|
||||
import { set } from '@ember/object';
|
||||
import Component from '@ember/component';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
email: "",
|
||||
|
|
|
@ -36,7 +36,7 @@ export default Component.extend(ModalMixin, {
|
|||
|
||||
this.pins = [];
|
||||
|
||||
if (this.get('appMeta.authProvider') === constants.AuthProvider.Keycloak) {
|
||||
if (this.get('appMeta.authProvider') !== constants.AuthProvider.Documize) {
|
||||
let config = this.get('appMeta.authConfig');
|
||||
config = JSON.parse(config);
|
||||
this.set('enableLogout', !config.disableLogout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue