add back role migration

This commit is contained in:
Maidul Islam
2023-09-25 11:51:17 -07:00
parent a255af6ad8
commit f51e9ba8ff
2 changed files with 18 additions and 1 deletions

View File

@@ -819,3 +819,18 @@ export const backfillPermission = async () => {
console.info("Could not acquire lock for script [backfillPermission], skipping");
}
};
export const migrateRoleFromOwnerToAdmin = async () => {
await MembershipOrg.updateMany(
{
role: OWNER
},
{
$set: {
role: ADMIN
}
}
);
console.info("Backfill: Finished converting owner role to member");
}

View File

@@ -18,7 +18,8 @@ import {
backfillServiceToken,
backfillServiceTokenMultiScope,
backfillTrustedIps,
backfillUserAuthMethods
backfillUserAuthMethods,
migrateRoleFromOwnerToAdmin
} from "./backfillData";
import {
reencryptBotOrgKeys,
@@ -85,6 +86,7 @@ export const setup = async () => {
await backfillTrustedIps();
await backfillUserAuthMethods();
// await backfillPermission();
await migrateRoleFromOwnerToAdmin()
// re-encrypt any data previously encrypted under server hex 128-bit ENCRYPTION_KEY
// to base64 256-bit ROOT_ENCRYPTION_KEY