Skip to content

Commit a845f56

Browse files
committed
fix(profile): restrict Create Account action to administrators only
1 parent e00c02c commit a845f56

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/app/features/profile/components/user-profile-security/user-profile-security.component.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ <h2>User Profile & Security</h2>
2121
</div>
2222

2323
<div class="profile-header__actions">
24-
<button pButton type="button" label="Create Account" icon="pi pi-user-plus" class="p-button-outlined" (click)="register()"></button>
24+
<button
25+
*ngIf="canCreateAccount()"
26+
pButton
27+
type="button"
28+
label="Create Account"
29+
icon="pi pi-user-plus"
30+
class="p-button-outlined"
31+
(click)="register()">
32+
</button>
2533
<button pButton type="button" label="Logout" icon="pi pi-sign-out" class="p-button-outlined" (click)="logout()"></button>
2634
</div>
2735
</div>

src/app/features/profile/components/user-profile-security/user-profile-security.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class UserProfileSecurityComponent {
2323
readonly claims = computed(() => this.authService.userClaims());
2424
readonly roles = computed(() => this.authService.userRoles());
2525
readonly currentUserId = computed(() => this.authService.currentUserId());
26+
readonly canCreateAccount = computed(() => this.authService.hasRole('Administrator'));
2627

2728
readonly userDisplayName = computed(() => {
2829
const claims = this.claims();

0 commit comments

Comments
 (0)