2020-11-12 22:20:25 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import Section from 'salix/components/section';
|
|
|
|
import UserError from 'core/lib/user-error';
|
|
|
|
|
|
|
|
export default class Controller extends Section {
|
|
|
|
onSynchronizeAll() {
|
|
|
|
this.vnApp.showSuccess(this.$t('Synchronizing in the background'));
|
2023-06-15 09:49:39 +00:00
|
|
|
this.$http.patch(`Accounts/syncAll`);
|
2020-11-12 22:20:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onUserSync() {
|
|
|
|
if (!this.syncUser)
|
|
|
|
throw new UserError('Please enter the username');
|
|
|
|
|
|
|
|
let params = {
|
|
|
|
password: this.syncPassword,
|
|
|
|
force: true
|
|
|
|
};
|
2023-01-31 13:57:24 +00:00
|
|
|
return this.$http.patch(`Accounts/${this.syncUser}/sync`, params)
|
2020-11-12 22:20:25 +00:00
|
|
|
.then(() => this.vnApp.showSuccess(this.$t('User synchronized!')));
|
|
|
|
}
|
|
|
|
|
|
|
|
onSynchronizeRoles() {
|
|
|
|
this.$http.patch(`RoleInherits/sync`)
|
|
|
|
.then(() => this.vnApp.showSuccess(this.$t('Roles synchronized!')));
|
|
|
|
}
|
|
|
|
|
|
|
|
onSyncClose() {
|
|
|
|
this.syncUser = '';
|
|
|
|
this.syncPassword = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.component('vnAccountAccounts', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|