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')); this.$http.patch(`Accounts/syncAll`); } onUserSync() { if (!this.syncUser) throw new UserError('Please enter the username'); let params = { password: this.syncPassword, force: true }; return this.$http.patch(`Accounts/${this.syncUser}/sync`, params) .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 });