| .. | .. |
|---|
| 23 | 23 | organizations_ids: [ 1, 2, 5, 6, 7, 8 ] |
|---|
| 24 | 24 | } |
|---|
| 25 | 25 | |
|---|
| 26 | +const ROL = { |
|---|
| 27 | + ADVANCE: 1, |
|---|
| 28 | + ADMIN: 2, |
|---|
| 29 | + BASIC: 4 |
|---|
| 30 | +} |
|---|
| 31 | + |
|---|
| 26 | 32 | @Component({ |
|---|
| 27 | 33 | selector: 'user-form', |
|---|
| 28 | 34 | templateUrl: 'src/app/forms/user.form.html' |
|---|
| .. | .. |
|---|
| 32 | 38 | allApplications: IComboOption[]; |
|---|
| 33 | 39 | orgNames: string[] = []; |
|---|
| 34 | 40 | appNames: string[] = []; |
|---|
| 35 | | - allRoles: any[] = [{"id":4, "code": "basic","label":"Basic"}, {"id":1, "code": "advance", "label":"Advance"}, {"id":2, "code": "admin","label":"Admin"}]; |
|---|
| 41 | + allRoles: any[] = [{"id":ROL.BASIC, "code": "basic","label":"Basic"}, |
|---|
| 42 | + {"id":ROL.ADVANCE, "code": "advance", "label":"Advance"}, |
|---|
| 43 | + {"id":ROL.ADMIN, "code": "admin","label":"Admin"}]; |
|---|
| 36 | 44 | user_orgs: string[] = []; |
|---|
| 37 | 45 | user_apps: string[] = []; |
|---|
| 38 | 46 | user_roles: any = {}; |
|---|
| .. | .. |
|---|
| 59 | 67 | var selectedApp = this.allApplications.find(app => app.label === appName); |
|---|
| 60 | 68 | this.data.applications_ids.push(selectedApp.id); |
|---|
| 61 | 69 | }); |
|---|
| 62 | | - this.user_roles.advance && this.data.roles.push(1); |
|---|
| 63 | | - this.user_roles.admin && this.data.roles.push(2); |
|---|
| 70 | + this.user_roles.basic && this.data.roles.push(ROL.BASIC); |
|---|
| 71 | + this.user_roles.advance && this.data.roles.push(ROL.ADVANCE); |
|---|
| 72 | + this.user_roles.admin && this.data.roles.push(ROL.ADMIN); |
|---|
| 64 | 73 | super.save('username'); |
|---|
| 65 | 74 | } |
|---|
| 66 | 75 | |
|---|