-
Notifications
You must be signed in to change notification settings - Fork 0
feat: complete user permissions management system #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
36b0b58
feat: implement complete user permissions management system
asithade b46d7b2
refactor: update language
asithade 141c08c
refactor: address pr comments
asithade 3cdb5b6
refactor: standardized data refresh (#25)
asithade de254ca
fix: update auth0 algorithm to its default RS256 value
asithade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
.../modules/project/settings/components/permissions-matrix/permissions-matrix.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <!-- Copyright The Linux Foundation and each contributor to LFX. --> | ||
| <!-- SPDX-License-Identifier: MIT --> | ||
| <lfx-card header="Permission Guide"> | ||
| <div class="space-y-4"> | ||
| <!-- Key Points --> | ||
| <div class="bg-blue-50 border border-blue-200 rounded p-3"> | ||
| <p class="text-xs text-blue-800"> | ||
| <strong>Key:</strong> Project permissions apply to all resources. Committee permissions are limited to assigned committees and their associated meetings | ||
| and/or mailing lists only. | ||
| </p> | ||
| </div> | ||
|
|
||
| <!-- Compact Permission Matrix --> | ||
| <div class="flex flex-col gap-3"> | ||
| @for (item of permissionMatrix; track item.scope + item.level) { | ||
| <div class="border border-gray-200 rounded-lg p-3"> | ||
| <div class="flex items-center justify-between mb-2"> | ||
| <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium" [class]="item.badge.bgColor + ' ' + item.badge.color"> | ||
| {{ item.scope }} {{ item.level }} | ||
| </span> | ||
| </div> | ||
| <p class="text-xs text-gray-600 mb-2">{{ item.description }}</p> | ||
| <ul class="text-xs text-gray-500 space-y-1"> | ||
| @for (capability of item.capabilities; track capability) { | ||
| <li class="flex items-start"> | ||
| <i class="fa-light fa-check text-green-500 mr-1 mt-0.5" style="font-size: 10px"></i> | ||
| {{ capability }} | ||
| </li> | ||
| } | ||
| </ul> | ||
| </div> | ||
| } | ||
| </div> | ||
| </div> | ||
| </lfx-card> |
67 changes: 67 additions & 0 deletions
67
...pp/modules/project/settings/components/permissions-matrix/permissions-matrix.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Copyright The Linux Foundation and each contributor to LFX. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| import { Component } from '@angular/core'; | ||
| import { CardComponent } from '@components/card/card.component'; | ||
| import { PermissionMatrixItem } from '@lfx-pcc/shared/interfaces'; | ||
|
|
||
| @Component({ | ||
| selector: 'lfx-permissions-matrix', | ||
| standalone: true, | ||
| imports: [CardComponent], | ||
| templateUrl: './permissions-matrix.component.html', | ||
| }) | ||
| export class PermissionsMatrixComponent { | ||
| protected readonly permissionMatrix: PermissionMatrixItem[] = [ | ||
| { | ||
| scope: 'Project', | ||
| level: 'View', | ||
| description: 'View all project resources', | ||
| capabilities: ['View project, committees, meetings, mailing lists'], | ||
| badge: { | ||
| color: 'text-blue-800', | ||
| bgColor: 'bg-blue-100', | ||
| }, | ||
| }, | ||
| { | ||
| scope: 'Project', | ||
| level: 'Manage', | ||
| description: 'Manage all project resources', | ||
| capabilities: ['Manage project, committees, meetings, mailing lists'], | ||
| badge: { | ||
| color: 'text-blue-800', | ||
| bgColor: 'bg-blue-100', | ||
| }, | ||
| }, | ||
| { | ||
| scope: 'Committee', | ||
| level: 'View', | ||
| description: 'View specific committee only, including meetings and mailing lists that are associated with the committees.', | ||
| capabilities: [ | ||
| 'Read project (limited to committees)', | ||
| 'Read assigned committees', | ||
| 'Read meetings associated with the committees', | ||
| 'Read mailing lists associated with the committees', | ||
| ], | ||
| badge: { | ||
| color: 'text-green-800', | ||
| bgColor: 'bg-green-100', | ||
| }, | ||
| }, | ||
| { | ||
| scope: 'Committee', | ||
| level: 'Manage', | ||
| description: 'Manage specific committee only, including meetings and mailing lists that are associated with the committees.', | ||
| capabilities: [ | ||
| 'Read project (limited to committees)', | ||
| 'Manage assigned committees', | ||
| 'Manage meetings associated with the committees', | ||
| 'Manage mailing lists associated with the committees', | ||
| ], | ||
| badge: { | ||
| color: 'text-green-800', | ||
| bgColor: 'bg-green-100', | ||
| }, | ||
| }, | ||
| ]; | ||
| } |
152 changes: 152 additions & 0 deletions
152
apps/lfx-pcc/src/app/modules/project/settings/components/user-form/user-form.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| <!-- Copyright The Linux Foundation and each contributor to LFX. --> | ||
| <!-- SPDX-License-Identifier: MIT --> | ||
|
|
||
| <form [formGroup]="form()" (ngSubmit)="onSubmit()" class="space-y-6"> | ||
| <!-- Basic Information Section --> | ||
| <div class="flex flex-col gap-3"> | ||
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | ||
| <!-- First Name --> | ||
| <div> | ||
| <label for="first-name" class="block text-sm font-medium text-gray-700 mb-1"> First Name <span class="text-red-500">*</span> </label> | ||
| <lfx-input-text | ||
| size="small" | ||
| [form]="form()" | ||
| control="first_name" | ||
| id="first-name" | ||
| placeholder="Enter first name" | ||
| styleClass="w-full" | ||
| data-testid="settings-user-form-first-name"></lfx-input-text> | ||
| @if (form().get('first_name')?.errors?.['required'] && form().get('first_name')?.touched) { | ||
| <p class="mt-1 text-xs text-red-600">First name is required</p> | ||
| } | ||
| </div> | ||
|
|
||
| <!-- Last Name --> | ||
| <div> | ||
| <label for="last-name" class="block text-sm font-medium text-gray-700 mb-1"> Last Name <span class="text-red-500">*</span> </label> | ||
| <lfx-input-text | ||
| size="small" | ||
| [form]="form()" | ||
| control="last_name" | ||
| id="last-name" | ||
| placeholder="Enter last name" | ||
| styleClass="w-full" | ||
| data-testid="settings-user-form-last-name"></lfx-input-text> | ||
| @if (form().get('last_name')?.errors?.['required'] && form().get('last_name')?.touched) { | ||
| <p class="mt-1 text-xs text-red-600">Last name is required</p> | ||
| } | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Email Address --> | ||
| <div> | ||
| <label for="email" class="block text-sm font-medium text-gray-700 mb-1"> Email Address <span class="text-red-500">*</span> </label> | ||
| <lfx-input-text | ||
| size="small" | ||
| [form]="form()" | ||
| control="email" | ||
| id="email" | ||
| placeholder="Enter email address" | ||
| styleClass="w-full" | ||
| data-testid="settings-user-form-email"></lfx-input-text> | ||
| @if (form().get('email')?.errors?.['required'] && form().get('email')?.touched) { | ||
| <p class="mt-1 text-xs text-red-600">Email address is required</p> | ||
| } | ||
| @if (form().get('email')?.errors?.['email'] && form().get('email')?.touched) { | ||
| <p class="mt-1 text-xs text-red-600">Please enter a valid email address</p> | ||
| } | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Permission Settings Section --> | ||
| <div class="flex flex-col gap-3"> | ||
| <!-- Permission Scope --> | ||
| <div> | ||
| <label class="block text-sm font-medium text-gray-700 mb-3">Permission Scope</label> | ||
| <div class="flex flex-col gap-2"> | ||
| @for (option of permissionScopeOptions; track option.value) { | ||
| <lfx-radio-button | ||
| [form]="form()" | ||
| control="permission_scope" | ||
| name="permission_scope" | ||
| [inputId]="'scope-' + option.value" | ||
| [value]="option.value" | ||
| [label]="option.label"></lfx-radio-button> | ||
| } | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Permission Level --> | ||
| <div> | ||
| <label class="block text-sm font-medium text-gray-700 mb-3">Permission Level</label> | ||
| <div class="flex flex-col gap-2"> | ||
| @for (option of permissionLevelOptions; track option.value) { | ||
| <lfx-radio-button | ||
| [form]="form()" | ||
| control="permission_level" | ||
| name="permission_level" | ||
| [inputId]="'level-' + option.value" | ||
| [value]="option.value" | ||
| [label]="option.label"></lfx-radio-button> | ||
| } | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Committee Selection (only when scope is committee) --> | ||
| @if (form().get('permission_scope')?.value === 'committee') { | ||
| <div> | ||
| <label for="committee-ids" class="block text-sm font-medium text-gray-700 mb-1">Select Committees <span class="text-red-500">*</span></label> | ||
| <p class="text-xs text-gray-500 mb-2">Choose which committees this user can access</p> | ||
| <lfx-multi-select | ||
| [form]="form()" | ||
| control="committee_ids" | ||
| [options]="committees()" | ||
| size="small" | ||
| placeholder="Select committees" | ||
| appendTo="body" | ||
| id="committee-ids" | ||
| data-testid="settings-user-form-committee-ids" | ||
| styleClass="w-full"></lfx-multi-select> | ||
| @if (form().get('committee_ids')?.errors?.['required'] && form().get('committee_ids')?.touched) { | ||
| <p class="mt-1 text-xs text-red-600">At least one committee must be selected</p> | ||
| } | ||
| </div> | ||
| } | ||
|
|
||
| <!-- Permission Summary --> | ||
| <div class="bg-gray-50 p-3 rounded-md text-sm"> | ||
| <div class="font-medium text-gray-700 mb-1">Permission Summary:</div> | ||
| @if (form().get('permission_scope')?.value === 'project') { | ||
| <div class="text-gray-600"> | ||
| <strong>{{ form().get('permission_level')?.value === 'read' ? 'Read-only' : 'Full' }}</strong> access to <strong>entire project</strong> including all | ||
| committees, meetings, and mailing lists. | ||
| </div> | ||
| } @else { | ||
| <div class="text-gray-600"> | ||
| <strong>{{ form().get('permission_level')?.value === 'read' ? 'Read-only' : 'Full' }}</strong> access to <strong>selected committees</strong> and | ||
| their associated meetings and mailing lists only. | ||
| </div> | ||
| } | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Form Actions --> | ||
| <div class="flex justify-end gap-3 pt-6 border-t"> | ||
| <lfx-button | ||
| label="Cancel" | ||
| severity="secondary" | ||
| [outlined]="true" | ||
| (click)="onCancel()" | ||
| size="small" | ||
| type="button" | ||
| data-testid="settings-user-form-cancel"></lfx-button> | ||
| <lfx-button | ||
| [label]="isEditing() ? 'Update User' : 'Add User'" | ||
| [loading]="submitting()" | ||
| [disabled]="submitting()" | ||
| type="submit" | ||
| size="small" | ||
| (onClick)="onSubmit()" | ||
| data-testid="settings-user-form-submit"></lfx-button> | ||
| </div> | ||
| </form> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.