mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
sync Keycloak users with Documize
This commit is contained in:
parent
b2620e80e1
commit
8c062d592a
11 changed files with 178 additions and 55 deletions
|
@ -111,5 +111,9 @@ export default Ember.Component.extend({
|
|||
this.get('onSave')(provider, config).then(() => {
|
||||
});
|
||||
},
|
||||
|
||||
onSync() {
|
||||
this.get('onSync')();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -27,6 +27,12 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
this.set('appMeta.authConfig', config);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onSync() {
|
||||
return this.get('global').syncExternalUsers().then((response) => {
|
||||
this.showNotification(response.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
{{auth-settings authProvider=model.authProvider authConfig=model.authConfig onSave=(action 'onSave')}}
|
||||
{{auth-settings authProvider=model.authProvider authConfig=model.authConfig onSave=(action 'onSave') onSync=(action 'onSync')}}
|
||||
|
|
|
@ -14,6 +14,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout
|
|||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
userService: Ember.inject.service('user'),
|
||||
global: Ember.inject.service('global'),
|
||||
|
||||
beforeModel: function () {
|
||||
if (!this.session.isAdmin) {
|
||||
|
@ -21,8 +22,14 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
}
|
||||
},
|
||||
|
||||
model: function () {
|
||||
return this.get('userService').getAll();
|
||||
model() {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('global').syncExternalUsers().then(() => {
|
||||
this.get('userService').getAll().then((users) =>{
|
||||
resolve(users);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
activate: function () {
|
||||
|
|
|
@ -73,5 +73,15 @@ export default Ember.Service.extend({
|
|||
data: JSON.stringify(config)
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
syncExternalUsers() {
|
||||
if(this.get('sessionService.isGlobalAdmin')) {
|
||||
return this.get('ajax').request(`users/sync`, {
|
||||
method: 'GET'
|
||||
}).then((response) => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -48,4 +48,6 @@
|
|||
{{/if}}
|
||||
|
||||
<div class="regular-button button-blue" {{action 'onSave'}}>save</div>
|
||||
<div class="button-gap" />
|
||||
<div class="regular-button button-green" {{action 'onSync'}}>sync users</div>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue