2020-03-09 08:00:03 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import Section from 'salix/components/section';
|
2023-04-25 13:17:45 +00:00
|
|
|
import UserError from 'core/lib/user-error';
|
2020-03-09 08:00:03 +00:00
|
|
|
|
2023-04-25 13:17:45 +00:00
|
|
|
export default class Controller extends Section {
|
|
|
|
onSubmit() {
|
|
|
|
this.getIsAuthorized();
|
|
|
|
}
|
|
|
|
|
|
|
|
getIsAuthorized() {
|
2023-04-26 07:48:02 +00:00
|
|
|
this.$http.get(`Workers/${this.$params.id}/isSubordinate`)
|
2023-04-25 13:17:45 +00:00
|
|
|
.then(res => {
|
2023-04-26 07:48:02 +00:00
|
|
|
this.isSubordinate = res.data;
|
|
|
|
if (!this.isSubordinate) throw new UserError(`You don't have enough privileges`);
|
2023-04-25 13:17:45 +00:00
|
|
|
this.$.watcher.submit();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2020-03-09 08:00:03 +00:00
|
|
|
|
|
|
|
ngModule.component('vnUserMailForwarding', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
require: {
|
|
|
|
card: '^vnUserCard'
|
|
|
|
},
|
|
|
|
});
|