|
1 |
| -import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; |
2 |
| -import { UserStore } from './user.store'; |
| 1 | +import { ChangeDetectionStrategy, Component } from '@angular/core'; |
| 2 | +import { PermissionDirective } from './directives/permission.directive'; |
3 | 3 |
|
4 | 4 | @Component({
|
5 | 5 | selector: 'app-information',
|
6 | 6 | template: `
|
7 | 7 | <h2 class="mt-10 text-xl">Information Panel</h2>
|
8 | 8 | <!-- admin can see everything -->
|
9 |
| - <div>visible only for super admin</div> |
10 |
| - <div>visible if manager</div> |
11 |
| - <div>visible if manager and/or reader</div> |
12 |
| - <div>visible if manager and/or writer</div> |
13 |
| - <div>visible if client</div> |
| 9 | + <div *appHasRoleSuperAdmin>visible only for super admin</div> |
| 10 | + <div *appHasRole="'MANAGER'">visible if manager</div> |
| 11 | + <div *appHasRole="['MANAGER', 'READER']"> |
| 12 | + visible if manager and/or reader |
| 13 | + </div> |
| 14 | + <div *appHasRole="['MANAGER', 'WRITER']"> |
| 15 | + visible if manager and/or writer |
| 16 | + </div> |
| 17 | + <div *appHasRole="['CLIENT']">visible if client</div> |
14 | 18 | <div>visible for everyone</div>
|
15 | 19 | `,
|
16 | 20 | changeDetection: ChangeDetectionStrategy.OnPush,
|
| 21 | + imports: [PermissionDirective], |
17 | 22 | })
|
18 |
| -export class InformationComponent { |
19 |
| - private readonly userStore = inject(UserStore); |
20 |
| - |
21 |
| - user$ = this.userStore.user$; |
22 |
| -} |
| 23 | +export class InformationComponent {} |
0 commit comments