2017-03-21 11:57:42 +00:00
|
|
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
|
|
|
//
|
|
|
|
// This software (Documize Community Edition) is licensed under
|
|
|
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
|
|
|
//
|
|
|
|
// You can operate outside the AGPL restrictions by purchasing
|
|
|
|
// Documize Enterprise Edition and obtaining a commercial license
|
|
|
|
// by contacting <sales@documize.com>.
|
|
|
|
//
|
|
|
|
// https://documize.com
|
|
|
|
|
2017-11-16 13:28:05 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import Mixin from '@ember/object/mixin';
|
2017-03-21 11:57:42 +00:00
|
|
|
|
2017-11-16 13:28:05 +00:00
|
|
|
export default Mixin.create({
|
|
|
|
appMeta: service(),
|
2017-03-21 11:57:42 +00:00
|
|
|
isAuthProviderDocumize: true,
|
2019-05-13 16:14:11 +01:00
|
|
|
isAuthProviderKeycloak: false,
|
|
|
|
isAuthProviderLDAP: false,
|
|
|
|
isDualAuth: false,
|
2017-03-21 11:57:42 +00:00
|
|
|
|
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
2018-04-20 14:38:10 +01:00
|
|
|
let constants = this.get('constants');
|
|
|
|
|
2017-03-21 11:57:42 +00:00
|
|
|
this.set('isAuthProviderDocumize', this.get('appMeta.authProvider') === constants.AuthProvider.Documize);
|
|
|
|
this.set('isAuthProviderKeycloak', this.get('appMeta.authProvider') === constants.AuthProvider.Keycloak);
|
2018-08-28 10:19:22 +01:00
|
|
|
this.set('isAuthProviderLDAP', this.get('appMeta.authProvider') === constants.AuthProvider.LDAP);
|
2019-05-13 16:14:11 +01:00
|
|
|
|
|
|
|
if (this.get('appMeta.authProvider') === constants.AuthProvider.LDAP) {
|
|
|
|
let config = this.get('appMeta.authConfig');
|
|
|
|
|
|
|
|
if (!_.isUndefined(config) && !_.isNull(config) && !_.isEmpty(config) ) {
|
|
|
|
config = JSON.parse(config);
|
|
|
|
this.set('isDualAuth', config.allowFormsAuth);
|
|
|
|
} else {
|
|
|
|
this.set('isDualAuth', false);
|
|
|
|
}
|
|
|
|
}
|
2017-03-21 11:57:42 +00:00
|
|
|
}
|
2018-04-20 14:38:10 +01:00
|
|
|
});
|