mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 13:56:43 +00:00
feat(rbac): made org role section permission into one component and fixed some small issues
This commit is contained in:
+2
-2
@@ -135,9 +135,9 @@ export const MultiEnvProjectPermission = ({
|
||||
<Tr>
|
||||
<Th />
|
||||
<Th className="min-w-[8rem]">Secret Path</Th>
|
||||
<Th className="text-center">Read</Th>
|
||||
<Th className="text-center">View</Th>
|
||||
<Th className="text-center">Create</Th>
|
||||
<Th className="text-center">Edit</Th>
|
||||
<Th className="text-center">Modify</Th>
|
||||
<Th className="text-center">Delete</Th>
|
||||
</Tr>
|
||||
</THead>
|
||||
|
||||
+1
-1
@@ -260,7 +260,7 @@ export const ProjectRoleModifySection = ({ role, onGoBack }: Props) => {
|
||||
/>
|
||||
</div>
|
||||
{SINGLE_PERMISSION_LIST.map(({ title, subtitle, icon, formName }) => (
|
||||
<div className="flex flex-col space-y-4" key={`permission-${title}`}>
|
||||
<div key={`permission-${title}`}>
|
||||
<SingleProjectPermission
|
||||
isNonEditable={isNonEditable}
|
||||
control={control}
|
||||
|
||||
+5
-2
@@ -94,7 +94,10 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
|
||||
|
||||
permissions.forEach((permission) => {
|
||||
if (["secrets", "folders", "secret-imports"].includes(permission.subject)) {
|
||||
multiEnvApi2Form(formVal[permission.subject], permission);
|
||||
multiEnvApi2Form(
|
||||
formVal[permission.subject] as TFormSchema["permissions"]["secrets"],
|
||||
permission
|
||||
);
|
||||
} else {
|
||||
// everything else follows same pattern
|
||||
// formVal[settings][read | write] = true
|
||||
@@ -135,7 +138,7 @@ const multiEnvForm2Api = (
|
||||
// if not full access for an action
|
||||
if (!formVal?.all?.[action] && action !== "secretPath" && formVal?.[slug]?.[action]) {
|
||||
const conditions: Record<string, unknown> = { environment: slug };
|
||||
if (formVal[slug]?.secretPath) conditions.secretPath = formVal[slug].secretPath;
|
||||
if (formVal[slug]?.secretPath) conditions.secretPath = formVal?.[slug]?.secretPath;
|
||||
|
||||
permissions.push({ action, subject, conditions });
|
||||
}
|
||||
|
||||
+2
-2
@@ -38,9 +38,9 @@ enum Permission {
|
||||
}
|
||||
|
||||
const PERMISSIONS = [
|
||||
{ action: "read", label: "Read" },
|
||||
{ action: "read", label: "View" },
|
||||
{ action: "create", label: "Create" },
|
||||
{ action: "edit", label: "Update" },
|
||||
{ action: "edit", label: "Modify" },
|
||||
{ action: "delete", label: "Remove" }
|
||||
] as const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user