Move authorization checks from Organizations GQL Types to Resolvers
Context: https://gitlab.slack.com/archives/C6MLS3XEU/p1758714656710469
Remove the :read_organization checks from the Types::Organizations::OrganizationType
Instead, we should do the authorization checks in the finders, namely:
app/finders/organizations/organizations_finder.rbapp/finders/organizations/user_organizations_finder.rb
The current implementation causes the API to have inaccurate count field and produce N+1 queries.
Implementation Guide
- Remove
authorize :read_organizationfrom app/graphql/types/organizations/organization_type.rb` - Update
Organizations::OrganizationsFinderto only return organizations that thecurrent_usercan access.- Anonymous users: No organization.
- Regular users: Organizations where they are a member of.
- Administrators: All organizations.
Edited by Shane Maglangit
