diff --git a/backend/src/utils/setup/backfillData.ts b/backend/src/utils/setup/backfillData.ts index a13b4f4fc..6a0c58216 100644 --- a/backend/src/utils/setup/backfillData.ts +++ b/backend/src/utils/setup/backfillData.ts @@ -753,7 +753,7 @@ export const backfillPermission = async () => { } }); - const key = `${JSON.stringify(secretPermissions)}-${membership.workspace.organization.toString()}-${membership.workspace._id.toString()}`; // group roles that have same permission with in the same org and workspace + const key = `${JSON.stringify(secretPermissions)}-${membership.workspace._id.toString()}`; // group roles that have same permission with in the same workspace const value = roleMap.get(key); if (value) { value.membershipIds.push(membership._id.toString()); @@ -766,14 +766,14 @@ export const backfillPermission = async () => { for (const [key, value] of roleMap.entries()) { const { membershipIds, permissions, workspaceId, organizationId } = value - + const membership_identity = crypto.randomBytes(3).toString("hex") const role = new Role({ - name: "Migrated Role", + name: `Migrated Role [${membership_identity.toUpperCase()}]`, organization: organizationId, workspace: workspaceId, description: "This role was auto generated by Infisical in effort to migrate your project members to our new permission system", isOrgRole: false, - slug: `custom-role-${crypto.randomBytes(3).toString("hex")}`, + slug: `custom-role-${membership_identity}`, permissions: permissions });