Skip to content

Commit

Permalink
Added resource filter for list role assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
danyi1212 committed Jul 8, 2024
1 parent 646a7e9 commit 4f9a23d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions permit/api/role_assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async def list(
user_key: Optional[Union[str, List[str]]] = None,
role_key: Optional[Union[str, List[str]]] = None,
tenant_key: Optional[Union[str, List[str]]] = None,
resource_key: Optional[str] = None,
resource_instance_key: Optional[str] = None,
page: int = 1,
per_page: int = 100,
Expand All @@ -57,6 +58,7 @@ async def list(
user_key: if specified, only role granted to this user will be fetched.
role_key: if specified, only assignments of this role will be fetched.
tenant_key: (for roles) if specified, only role granted within this tenant will be fetched.
resource_key: (for resource roles) if specified, only roles granted on instances of this resource type will be fetched.
resource_instance_key: (for resource roles) if specified, only roles granted with this instance as the object will be fetched.
page: The page number to fetch (default: 1).
per_page: How many items to fetch per page (default: 100).
Expand Down Expand Up @@ -87,6 +89,8 @@ async def list(
params.append(("tenant", tenant))
else:
params.append(("tenant", tenant_key))
if resource_key is not None:
params.append(("resource", resource_key))
if resource_instance_key is not None:
params.append(("resource_instance", resource_instance_key))
return await self.__role_assignments.get(
Expand Down

0 comments on commit 4f9a23d

Please sign in to comment.