Skip to content

Commit acb92e2

Browse files
committed
feat: add structural directives to manage the sections view
1 parent a6e0565 commit acb92e2

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
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';
33

44
@Component({
55
selector: 'app-information',
66
template: `
77
<h2 class="mt-10 text-xl">Information Panel</h2>
88
<!-- 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>
1418
<div>visible for everyone</div>
1519
`,
1620
changeDetection: ChangeDetectionStrategy.OnPush,
21+
imports: [PermissionDirective],
1722
})
18-
export class InformationComponent {
19-
private readonly userStore = inject(UserStore);
20-
21-
user$ = this.userStore.user$;
22-
}
23+
export class InformationComponent {}

0 commit comments

Comments
 (0)