mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 10:26:16 +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);
|
const value = roleMap.get(key);
|
||||||
if (value) {
|
if (value) {
|
||||||
value.membershipIds.push(membership._id.toString());
|
value.membershipIds.push(membership._id.toString());
|
||||||
@@ -766,14 +766,14 @@ export const backfillPermission = async () => {
|
|||||||
|
|
||||||
for (const [key, value] of roleMap.entries()) {
|
for (const [key, value] of roleMap.entries()) {
|
||||||
const { membershipIds, permissions, workspaceId, organizationId } = value
|
const { membershipIds, permissions, workspaceId, organizationId } = value
|
||||||
|
const membership_identity = crypto.randomBytes(3).toString("hex")
|
||||||
const role = new Role({
|
const role = new Role({
|
||||||
name: "Migrated Role",
|
name: `Migrated Role [${membership_identity.toUpperCase()}]`,
|
||||||
organization: organizationId,
|
organization: organizationId,
|
||||||
workspace: workspaceId,
|
workspace: workspaceId,
|
||||||
description: "This role was auto generated by Infisical in effort to migrate your project members to our new permission system",
|
description: "This role was auto generated by Infisical in effort to migrate your project members to our new permission system",
|
||||||
isOrgRole: false,
|
isOrgRole: false,
|
||||||
slug: `custom-role-${crypto.randomBytes(3).toString("hex")}`,
|
slug: `custom-role-${membership_identity}`,
|
||||||
permissions: permissions
|
permissions: permissions
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user