feat(Can): use new manage permission in checks

This commit is contained in:
Ali BARIN
2025-04-02 10:27:57 +00:00
parent ee1b910f3c
commit 6c0a5aad76
12 changed files with 32 additions and 32 deletions

View File

@@ -31,7 +31,7 @@ export default (
<Route
path={URLS.CREATE_USER}
element={
<Can I="create" a="User">
<Can I="manage" a="User">
<CreateUser />
</Can>
}
@@ -40,7 +40,7 @@ export default (
<Route
path={URLS.USER_PATTERN}
element={
<Can I="update" a="User">
<Can I="manage" a="User">
<EditUser />
</Can>
}
@@ -58,7 +58,7 @@ export default (
<Route
path={URLS.CREATE_ROLE}
element={
<Can I="create" a="Role">
<Can I="manage" a="Role">
<CreateRole />
</Can>
}
@@ -67,7 +67,7 @@ export default (
<Route
path={URLS.ROLE_PATTERN}
element={
<Can I="update" a="Role">
<Can I="manage" a="Role">
<EditRole />
</Can>
}
@@ -76,7 +76,7 @@ export default (
<Route
path={URLS.USER_INTERFACE}
element={
<Can I="update" a="Config">
<Can I="manage" a="Config">
<UserInterface />
</Can>
}
@@ -86,8 +86,8 @@ export default (
path={URLS.AUTHENTICATION}
element={
<Can I="read" a="SamlAuthProvider">
<Can I="update" a="SamlAuthProvider">
<Can I="create" a="SamlAuthProvider">
<Can I="manage" a="SamlAuthProvider">
<Can I="manage" a="SamlAuthProvider">
<Authentication />
</Can>
</Can>
@@ -98,7 +98,7 @@ export default (
<Route
path={URLS.ADMIN_APPS}
element={
<Can I="update" a="App">
<Can I="manage" a="App">
<AdminApplications />
</Can>
}
@@ -107,7 +107,7 @@ export default (
<Route
path={`${URLS.ADMIN_APP_PATTERN}/*`}
element={
<Can I="update" a="App">
<Can I="manage" a="App">
<AdminApplication />
</Can>
}
@@ -116,7 +116,7 @@ export default (
<Route
path={`${URLS.ADMIN_TEMPLATES}/*`}
element={
<Can I="update" a="Config">
<Can I="manage" a="Config">
<AdminTemplates />
</Can>
}
@@ -125,7 +125,7 @@ export default (
<Route
path={`${URLS.ADMIN_CREATE_TEMPLATE_PATTERN}/*`}
element={
<Can I="update" a="Config">
<Can I="manage" a="Config">
<AdminCreateTemplate />
</Can>
}
@@ -134,7 +134,7 @@ export default (
<Route
path={`${URLS.ADMIN_UPDATE_TEMPLATE_PATTERN}/*`}
element={
<Can I="update" a="Config">
<Can I="manage" a="Config">
<AdminUpdateTemplate />
</Can>
}

View File

@@ -41,7 +41,7 @@ function AdminTemplateContextMenu(props) {
hideBackdrop={false}
anchorEl={anchorEl}
>
<Can I="delete" a="Flow" passThrough>
<Can I="manage" a="Flow" passThrough>
{(allowed) => (
<MenuItem disabled={!allowed} onClick={onTemplateDelete}>
{formatMessage('adminTemplateContextMenu.delete')}

View File

@@ -51,7 +51,7 @@ function ContextMenu(props) {
)}
</Can>
<Can I="update" a="Connection" passThrough>
<Can I="manage" a="Connection" passThrough>
{(allowed) => (
<MenuItem
onClick={createActionHandler({ type: 'test' })}
@@ -62,7 +62,7 @@ function ContextMenu(props) {
)}
</Can>
<Can I="create" a="Connection" passThrough>
<Can I="manage" a="Connection" passThrough>
{(allowed) => (
<MenuItem
component={Link}
@@ -79,7 +79,7 @@ function ContextMenu(props) {
)}
</Can>
<Can I="delete" a="Connection" passThrough>
<Can I="manage" a="Connection" passThrough>
{(allowed) => (
<MenuItem
onClick={createActionHandler({ type: 'delete' })}

View File

@@ -20,7 +20,7 @@ function AppConnections(props) {
if (!hasConnections) {
return (
<Can I="create" a="Connection" passThrough>
<Can I="manage" a="Connection" passThrough>
{(allowed) => (
<NoResultFound
text={formatMessage('app.noConnections')}

View File

@@ -37,7 +37,7 @@ function AppFlows(props) {
if (!hasFlows) {
return (
<Can I="create" a="Flow" passThrough>
<Can I="manage" a="Flow" passThrough>
{(allowed) => (
<NoResultFound
text={formatMessage('app.noFlows')}

View File

@@ -53,7 +53,7 @@ function DeleteRoleButton(props) {
return (
<>
<Can I="delete" a="Role" passThrough>
<Can I="manage" a="Role" passThrough>
{(allowed) => (
<IconButton
disabled={!allowed || disabled}

View File

@@ -126,7 +126,7 @@ export default function EditorLayout() {
)}
</Can>
<Can I="publish" a="Flow" passThrough>
<Can I="manage" a="Flow" passThrough>
{(allowed) => (
<Button
disabled={!allowed || !flow}

View File

@@ -130,7 +130,7 @@ function ContextMenu(props) {
)}
</Can>
<Can I="create" a="Flow" passThrough>
<Can I="manage" a="Flow" passThrough>
{(allowed) => (
<MenuItem disabled={!allowed} onClick={onFlowDuplicate}>
{formatMessage('flow.duplicate')}
@@ -139,7 +139,7 @@ function ContextMenu(props) {
</Can>
{isCurrentUserAdmin && (
<Can I="create" a="Flow" passThrough>
<Can I="manage" a="Flow" passThrough>
{(allowed) => (
<MenuItem disabled={!allowed} onClick={onCreateTemplate}>
{formatMessage('flow.createTemplateFromFlow')}
@@ -148,7 +148,7 @@ function ContextMenu(props) {
</Can>
)}
<Can I="update" a="Flow" passThrough>
<Can I="manage" a="Flow" passThrough>
{(allowed) => (
<MenuItem disabled={!allowed} onClick={onFlowFolderUpdate}>
{formatMessage('flow.moveTo')}
@@ -164,7 +164,7 @@ function ContextMenu(props) {
)}
</Can>
<Can I="delete" a="Flow" passThrough>
<Can I="manage" a="Flow" passThrough>
{(allowed) => (
<MenuItem disabled={!allowed} onClick={onFlowDelete}>
{formatMessage('flow.delete')}

View File

@@ -139,7 +139,7 @@ export default function Application() {
<Route
path={`${URLS.FLOWS}/*`}
element={
<Can I="create" a="Flow" passThrough>
<Can I="manage" a="Flow" passThrough>
{(allowed) => (
<ConditionalIconButton
type="submit"
@@ -162,7 +162,7 @@ export default function Application() {
<Route
path={`${URLS.CONNECTIONS}/*`}
element={
<Can I="create" a="Connection" passThrough>
<Can I="manage" a="Connection" passThrough>
{(allowed) => (
<SplitButton
disabled={!allowed}
@@ -248,7 +248,7 @@ export default function Application() {
<Route
path="/connections/add"
element={
<Can I="create" a="Connection">
<Can I="manage" a="Connection">
<AddAppConnection
onClose={goToApplicationPage}
application={app}
@@ -260,7 +260,7 @@ export default function Application() {
<Route
path="/connections/:connectionId/reconnect"
element={
<Can I="create" a="Connection">
<Can I="manage" a="Connection">
<ReconnectConnection
application={app}
onClose={goToApplicationPage}

View File

@@ -53,7 +53,7 @@ export default function Applications() {
alignItems="center"
order={{ xs: 1, sm: 2 }}
>
<Can I="create" a="Connection" passThrough>
<Can I="manage" a="Connection" passThrough>
{(allowed) => (
<ConditionalIconButton
type="submit"
@@ -84,7 +84,7 @@ export default function Applications() {
)}
{!isLoading && !hasApps && (
<Can I="create" a="Connection" passThrough>
<Can I="manage" a="Connection" passThrough>
{(allowed) => (
<NoResultFound
text={formatMessage('apps.noConnections')}

View File

@@ -125,7 +125,7 @@ export default function CreateUser() {
helperText={errors?.email?.message}
/>
<Can I="update" a="Role">
<Can I="manage" a="Role">
<ControlledAutocomplete
name="roleId"
fullWidth

View File

@@ -169,7 +169,7 @@ export default function EditUser() {
helperText={errors?.email?.message}
/>
<Can I="update" a="Role">
<Can I="manage" a="Role">
<ControlledAutocomplete
name="roleId"
fullWidth