Skip to content

Commit

Permalink
fix: add check for plugin resource type (#26558)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
zlwaterfield and github-actions[bot] authored Jan 2, 2025
1 parent 926499c commit 3d56dd6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions posthog/rbac/user_access_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ def _access_controls_filters_for_object(self, resource: APIScopeObject, resource
"""
Used when checking an individual object - gets all access controls for the object and its type
"""
# Plugins are a special case because they don't belong to a team, instead they belong to an organization
if resource == "plugin":
return {
"team__organization_id": str(self._organization_id),
"resource": resource,
"resource_id": resource_id,
}

return {"team_id": self._team.id, "resource": resource, "resource_id": resource_id} # type: ignore

def _access_controls_filters_for_resource(self, resource: APIScopeObject) -> dict:
Expand Down

0 comments on commit 3d56dd6

Please sign in to comment.