Closed d02ev closed 3 weeks ago
The pull request introduces substantial modifications across multiple files, focusing on enhancing user role permissions and access control in the backend, along with improvements to frontend components for better state management and user experience. New permissions for the ADMIN
role have been added, and middleware for access control has been integrated into various routes. Additionally, frontend components have been refactored to utilize new state management techniques and to conditionally render elements based on user roles.
File Path | Changes Summary |
---|---|
backend/config/settings.js |
Added permissions: popups , hints , banners for userRole.ADMIN . |
backend/src/controllers/banner.controller.js |
Updated editBanner method: added url , bannerText , and modified validation checks. |
backend/src/controllers/popup.controller.js |
Refactored editPopup method: introduced destructuring for request body parameters. |
backend/src/routes/banner.routes.js |
Added accessGuard middleware to routes for adding, deleting, and editing banners. |
backend/src/routes/hint.routes.js |
Added accessGuard middleware to routes for adding, deleting, and editing hints. |
backend/src/routes/popup.routes.js |
Added accessGuard middleware to routes for popup management. |
frontend/src/components/HintPageComponents/... |
Refactored HintLeftContent component to accept new props and handle state updates directly. |
frontend/src/scenes/hints/CreateHintPage.jsx |
Enhanced functionality for creating/editing hints with new state variables and onSave method. |
frontend/src/scenes/hints/HintDefaultPage.jsx |
Replaced mock hints with dynamic fetching from API; updated deletion logic. |
frontend/src/scenes/popup/CreatePopupPage.jsx |
Minor modifications; retained error handling and state management. |
frontend/src/services/bannerServices.js |
Changed endpoint in getBanners from /banner/banners to /banner/all_banners . |
frontend/src/services/hintServices.js |
Introduced new service functions for managing hints: addHint , editHint , deleteHint , getHints , getHintById . |
frontend/src/services/popupServices.js |
Changed endpoint in getPopups from /popup/popups to /popup/all_popups . |
frontend/src/templates/... |
Various components updated for role-based rendering and state management improvements. |
frontend/src/utils/guideHelper.js |
Modified emitToastError to access error messages from a new structure. |
frontend/src/utils/loginHelper.js |
Updated handleAuthSuccess to include id and role in the payload. |
CreatePopupPage.jsx
may address the performance concerns mentioned regarding the useEffect
implementation.setOrg
, which is relevant to the changes in user permissions.banner.controller.js
, which relates to the overall improvements in error handling and permissions.backend
, frontend
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
accessGuard.middleware
on allCUD
operations onHints
,Popups
andBanners
. Now, onlyadmins
can CUD them.hintServices.js
.Edit Banner
error andEdit Popup
error.Hints
page to be able to communicate with the BE.Screenshots:
Logged in user:
admin
Logged in user:
member