Skip to content

Migrate admin_bot to per-organization calls

Per &18745 , we need to migrate all cluster-wide internal bot users to instead use per-organization internal bot users. This is necessary for Cells and Protocells, to ensure that each user belongs to a single organization and that no user has permissions outside of that organization. This will also allow things like bot comments and issues to be migrated across Cells when an organization is moved, since the associated user is moved along with it.

Note that provisioning and referencing per-organization internal bot users is controlled by a per-organization feature flag. Once new code is deployed for the user type, no behavior will change immediately. Rollout is per-organization and controlled in this issue: #547109

This issue covers the migration of admin_bot

Current code:

# legacy calls
Users::Internal.admin_bot

After this issue is complete:

# find the appropriate organization for the action being taken by the admin_bot
my_organization = group.organization || project.organization || user.organization || ::Current.organization
Users::Internal.for_organization(my_organization).admin_bot
Edited by Andrew Evans