1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 13:19:43 +02:00
documize/gui/app/pods/customize/auth/route.js

71 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-03-14 17:19:53 +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
import { Promise as EmberPromise } from 'rsvp';
import { inject as service } from '@ember/service';
2017-03-14 17:19:53 +00:00
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
2018-08-28 10:19:22 +01:00
import Route from '@ember/routing/route';
2017-03-14 17:19:53 +00:00
export default Route.extend(AuthenticatedRouteMixin, {
appMeta: service(),
session: service(),
global: service(),
2017-03-14 17:19:53 +00:00
beforeModel() {
if (!this.get("session.isGlobalAdmin")) {
this.transitionTo('auth.login');
}
},
model() {
let data = {
authProvider: this.get('appMeta.authProvider'),
authConfig: null,
};
2018-08-28 10:19:22 +01:00
// TEST
// TEST
// TEST
// TEST
// TEST
this.get('global').syncLDAP().then(() => {});
// TEST
// TEST
// TEST
// TEST
// TEST
return new EmberPromise((resolve) => {
2018-04-20 14:38:10 +01:00
let constants = this.get('constants');
this.get('global').getAuthConfig().then((config) => {
switch (data.authProvider) {
case constants.AuthProvider.Keycloak:
data.authConfig = config;
break;
2018-08-28 10:19:22 +01:00
case constants.AuthProvider.LDAP:
data.authConfig = config;
break;
case constants.AuthProvider.Documize:
data.authConfig = '';
break;
}
2017-03-14 17:19:53 +00:00
resolve(data);
});
});
2017-03-14 17:19:53 +00:00
},
activate() {
2018-01-24 13:23:11 +00:00
this.get('browser').setTitle('Authentication');
2017-03-14 17:19:53 +00:00
}
});