(ctx context.Context, organizationID uuid.UUID)
| 3832 | } |
| 3833 | |
| 3834 | func (q *querier) GetOrganizationResourceCountByID(ctx context.Context, organizationID uuid.UUID) (database.GetOrganizationResourceCountByIDRow, error) { |
| 3835 | // Can read org members |
| 3836 | if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceOrganizationMember.InOrg(organizationID)); err != nil { |
| 3837 | return database.GetOrganizationResourceCountByIDRow{}, err |
| 3838 | } |
| 3839 | |
| 3840 | // Can read org workspaces |
| 3841 | if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceWorkspace.InOrg(organizationID)); err != nil { |
| 3842 | return database.GetOrganizationResourceCountByIDRow{}, err |
| 3843 | } |
| 3844 | |
| 3845 | // Can read org groups |
| 3846 | if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceGroup.InOrg(organizationID)); err != nil { |
| 3847 | return database.GetOrganizationResourceCountByIDRow{}, err |
| 3848 | } |
| 3849 | |
| 3850 | // Can read org templates |
| 3851 | if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceTemplate.InOrg(organizationID)); err != nil { |
| 3852 | return database.GetOrganizationResourceCountByIDRow{}, err |
| 3853 | } |
| 3854 | |
| 3855 | // Can read org provisioner daemons |
| 3856 | if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceProvisionerDaemon.InOrg(organizationID)); err != nil { |
| 3857 | return database.GetOrganizationResourceCountByIDRow{}, err |
| 3858 | } |
| 3859 | |
| 3860 | return q.db.GetOrganizationResourceCountByID(ctx, organizationID) |
| 3861 | } |
| 3862 | |
| 3863 | func (q *querier) GetOrganizations(ctx context.Context, args database.GetOrganizationsParams) ([]database.Organization, error) { |
| 3864 | fetch := func(ctx context.Context, _ interface{}) ([]database.Organization, error) { |
nothing calls this directly
no test coverage detected