diff --git a/CHANGELOG.md b/CHANGELOG.md index 9549ffeb6..5dc051fa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 1.25.1 (2024-01-17) + +### Miscellaneous Tasks + +- Sidebar refactoring & permissions added ([#264](https://github.com/juspay/hyperswitch-control-center/pull/264)) ([`f428679`](https://github.com/juspay/hyperswitch-control-center/commit/f428679fa9b98e002e8bb1f670af65595ae64845)) +- Access Control Module added ([#266](https://github.com/juspay/hyperswitch-control-center/pull/266)) ([`59d0b53`](https://github.com/juspay/hyperswitch-control-center/commit/59d0b5387476536ed3a7f6a9f3468a3bd115232f)) + +**Full Changelog:** [`v1.25.0...v1.25.1`](https://github.com/juspay/hyperswitch-control-center/compare/v1.25.0...v1.25.1) + +- - - + + ## 1.25.0 (2024-01-16) ### Features diff --git a/src/components/EntityScaffold.res b/src/components/EntityScaffold.res index bea10957d..68afbe809 100644 --- a/src/components/EntityScaffold.res +++ b/src/components/EntityScaffold.res @@ -1,89 +1,32 @@ -module ComingSoon = { - @react.component - let make = (~title) => { -
-
{React.string(title)}
-
{React.string("Coming soon...")}
-
- } -} - -module ShowPage = { - @react.component - let make = (~entityName, ~id) => { -
-
- {React.string(`Show ${entityName} `)} - {React.string(`#${id}`)} -
-
{React.string("Coming soon...")}
-
- } -} - -module UnauthorizedPage = { - @react.component - let make = (~entityName) => { -
-
{React.string(entityName)}
-
{React.string("You don't have access to this module. Contact admin for access")}
-
- } -} - @react.component let make = ( ~entityName="", ~remainingPath, ~isAdminAccount=false, - ~access: AuthTypes.authorization=ReadWrite, - ~renderList=() => , - ~renderNewForm=() => , + ~access: AuthTypes.authorization=Access, + ~renderList, + ~renderNewForm=?, ~renderShow=?, - ~renderOrder=?, - ~renderEdit=_id => , - ~renderEditWithMultiId=(_id1, _id2) => , - ~renderClone=_id => , ) => { if access === NoAccess { - + } else { switch remainingPath { | list{"new"} => switch access { - | ReadWrite => renderNewForm() - | Checker => isAdminAccount ? renderNewForm() : - | _ => - } - | list{id, "clone"} => - switch access { - | ReadWrite => renderClone(id) - | _ => + | Access => + switch renderNewForm { + | Some(element) => element() + | None => React.null + } + | NoAccess => } | list{id} => let page = switch renderShow { | Some(fn) => fn(id) - | None => + | None => React.null } page - | list{id, "edit"} => - switch access { - | ReadWrite => renderEdit(id) - | Checker => isAdminAccount ? renderEdit(id) : - | _ => - } - | list{id1, id2, "edit"} => - switch access { - | ReadWrite => renderEditWithMultiId(id1, id2) - | Checker => - isAdminAccount ? renderEditWithMultiId(id1, id2) : - | _ => - } - | list{"order", id} => - switch renderOrder { - | Some(fn) => fn(id) - | None => - } | list{} => renderList() | _ => } diff --git a/src/components/UnauthorizedPage.res b/src/components/UnauthorizedPage.res new file mode 100644 index 000000000..55bddadc9 --- /dev/null +++ b/src/components/UnauthorizedPage.res @@ -0,0 +1,19 @@ +@react.component +let make = (~message="You don't have access to this module. Contact admin for access") => { + let {setDashboardPageState} = React.useContext(GlobalProvider.defaultContext) + React.useEffect0(() => { + RescriptReactRouter.replace("/unauthorized") + None + }) + +