Skip to content

feat: implement permission based UI rendering#81

Open
ManthanTerse wants to merge 3 commits into
NexGenStudioDev:masterfrom
ManthanTerse:feature/permission-based-ui-rendering
Open

feat: implement permission based UI rendering#81
ManthanTerse wants to merge 3 commits into
NexGenStudioDev:masterfrom
ManthanTerse:feature/permission-based-ui-rendering

Conversation

@ManthanTerse
Copy link
Copy Markdown

Related Issue

Closes #60

Overview

Implemented a permission-based UI rendering system to control access to UI actions based on user permissions.

Changes Made

  • Added centralized permission management
  • Integrated Redux for global permission state handling
  • Used TanStack Query for fetching and caching permissions
  • Created reusable useAuthorization hook
  • Added conditional rendering for permission-based UI elements
  • Improved component structure and UI consistency

Permission Constants Added

export const Event_Permissions = {
  CREATE_EVENT: "event:create",
  UPDATE_EVENT: "event:update",
  DELETE_EVENT: "event:delete",
  VIEW_EVENT: "event:view",
  PUBLISH_EVENT: "event:publish",
  JOIN_EVENT: "event:join",
  LEAVE_EVENT: "event:leave",
};

Features

  • Role/permission-based UI access
  • Reusable authorization logic
  • Optimized permission fetching with caching
  • Cleaner and scalable architecture

Testing

  • Verified conditional rendering for different permissions
  • Checked Redux state updates and query caching
  • Ensured restricted actions are hidden for unauthorized users

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a role-based access control (RBAC) system using Redux Toolkit and React Query, introducing a centralized permissions framework with custom hooks and components. Authorization checks have been integrated across the Member, Event, Contact, and Project modules to secure pages and conditional UI elements. Feedback highlights a recurring issue where components fail to handle the isLoading state, potentially causing authorized users to see a brief 'Access Denied' flash. Additionally, improvements were suggested for the user experience in the Support and Member features to ensure that read-only states do not display misleading or non-functional UI elements.

Comment thread src/features/AddMember/v1/Page/AddMemberPage.tsx Outdated
Comment thread src/features/Contact_And_Support/v1/Pages/Contact.tsx Outdated
Comment thread src/features/Events/v1/Pages/CreateNewEvent.tsx Outdated
Comment thread src/features/Events/v1/Pages/ViewEvent.tsx Outdated
Comment thread src/features/Member/v1/Pages/MemberPage.tsx Outdated
Comment thread src/features/Projects/Pages/ProjectsPage.tsx Outdated
Comment thread src/features/Contact_And_Support/v1/Components/Support.tsx Outdated
Comment thread src/features/Member/v1/Components/MemberTable.tsx
@abhishek-nexgen-dev
Copy link
Copy Markdown
Member

@ManthanTerse Change's Required

@ManthanTerse ManthanTerse force-pushed the feature/permission-based-ui-rendering branch from 08a8d53 to c5428e9 Compare May 12, 2026 15:38
@ManthanTerse
Copy link
Copy Markdown
Author

Hello @abhishek-nexgen-dev !
I've resolved it!
Please review it and merge this!
Thankyou!

@abhishek-nexgen-dev
Copy link
Copy Markdown
Member

@ManthanTerse why you push code forcely

@ManthanTerse
Copy link
Copy Markdown
Author

ManthanTerse commented May 12, 2026

Because like 1-2 project admins told me instead of committing, push force the changes using amend @abhishek-nexgen-dev.

@abhishek-nexgen-dev
Copy link
Copy Markdown
Member

@ManthanTerse make sure the code must written in production grade arrage every things properly make different custom hook the code must me clean modern and easy to use

  • please create a doc also inside doc folder so that any one can understand why this permission based ui render use why we use it , how to use it and many more question with detail post

@ManthanTerse ManthanTerse force-pushed the feature/permission-based-ui-rendering branch from f6116c5 to c564766 Compare May 13, 2026 08:37
@ManthanTerse
Copy link
Copy Markdown
Author

ManthanTerse commented May 13, 2026

Hello @abhishek-nexgen-dev !
I have made the changes as per u told like the permission system into a cleaner production-style structure and added detailed docs.
The main pages now use a consistent boundary pattern instead of repeating manual loading/denied checks, and components like event/member/contact action areas now use usePermissionMap so the access logic is easier to read and maintain. The documentation is in docs/Permission-Based-UI-Rendering.md, covering why we use permission-based UI rendering, architecture, data flow, how to use each hook/component, production guidelines, FAQs and how to extend the system safely.

Please review it once!
And merge it!
Thankyou!!

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.

Implement Permission-Based UI Rendering with Redux and TanStack Query

2 participants