mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
add prefix for role name
This commit is contained in:
@@ -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
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user