Skip to content

a user can be in the admins array but not the users array #1768

@ElectricNroff

Description

@ElectricNroff

if (incomingParameters?.org_short_name) {
// Remove us from the old users Array
const filteredUuids = registryOrg.users.filter(uuid => uuid !== registryUser.UUID)
registryOrg.users = filteredUuids
// Add us to the new org (this is a genuine cross-org migration, so we must fetch the new org)
const newOrg = await baseOrgRepository.getOrgObject(incomingParameters.org_short_name)
newOrg.users = [...new Set([...newOrg.users, registryUser.UUID])]
if (registryUser.role.includes('ADMIN')) {
newOrg.admins = [...new Set([...(newOrg.admins || []), registryUser.UUID])]
}
legacyUser.org_UUID = newOrg.UUID
await newOrg.save(options)
}

This Secretariat-only code path has no step for "Remove us from the old admins Array" (if present there).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions