Skip to content

add admin edit privileges for empl directory#69

Merged
Thomasbenissan merged 2 commits intomainfrom
feature/employee-directory-admin-access
Mar 27, 2026
Merged

add admin edit privileges for empl directory#69
Thomasbenissan merged 2 commits intomainfrom
feature/employee-directory-admin-access

Conversation

@mia-oww
Copy link
Copy Markdown
Contributor

@mia-oww mia-oww commented Mar 16, 2026

This PR changes employee directory admin permissions, by allowing users with admin privilege to edit other employee profiles in the directory. Previously, only users could edit their own profile, with no special admin permissions.

mia-oww and others added 2 commits March 15, 2026 22:19
Resolved merge conflicts in EmployeeDirectory.tsx: kept main's API-fetching
approach while adding isAdmin prop from this branch. Updated page.tsx to pass
isAdmin from the already-fetched userMetadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Thomasbenissan
Copy link
Copy Markdown
Collaborator

Overall looks great! A couple things to note:

This PR was based on an older version of EmployeeDirectory that took userId, username, userRole, and userMetadata as props. After PR #72 merged, the component was refactored to only take id and fetch employee data from the backend API.

So I just went in and made a couple fixes:

Merged main into this branch and resolved the conflict in EmployeeDirectory.tsx
Kept the new backend-driven data fetching from main, added isAdmin as a clean separate prop instead of deriving it from the old userMetadata prop
Updated page.tsx to pass isAdmin={data.is_admin ?? false} from the already-fetched user metadata
SidePanel and ProfileTile admin logic (the core contribution of this PR) was preserved as-is
The canEdit = isCurrentUser || isAdmin logic in ProfileTile and the Admin badge display work correctly with the updated component structure.

Again, good work!

@Thomasbenissan Thomasbenissan merged commit dece3f8 into main Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants