Skip to content

Python SDK Function for PDP List Role Assignments - #64

Closed
maya-barak wants to merge 1 commit into
mainfrom
maya/per-9469-python-sdk-function-for-pdp-list-role-assignments
Closed

maya-barak wants to merge 1 commit into
mainfrom
maya/per-9469-python-sdk-function-for-pdp-list-role-assignments

Conversation

@maya-barak

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread permit/pdp_api/pdp_api.py
params.update(dict(user=user))
if role is not None:
params.update(dict(role=role))
if tenant is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing resource condition

Comment thread permit/pdp_api/pdp_api.py
Comment on lines +68 to +69
class SyncEnforcer(PdpApi, metaclass=SyncClass):
pass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Comment thread permit/pdp_api/pdp_api.py
resource_instance: Optional[str] = None,
page: int = 1,
per_page: int = 100,
) -> dict:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No schema ?

Comment thread permit/permit.py

Usage example:

permit = Permit(token

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing rest of the line

Comment thread tests/test_rbac_e2e.py


async def test_permission_check_e2e(permit: Permit):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Comment thread tests/test_rbac_e2e.py
logger.info("testing bulk permission check")
assert (
await permit.bulk_check(
await permit.pdp_api.list_role_assignment(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changing this

@RazcoDev RazcoDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some major comments - also, no interfaces ?

@danyi1212 danyi1212 closed this Apr 29, 2025
@danyi1212 danyi1212 reopened this Apr 29, 2025
@zeevmoney

Copy link
Copy Markdown
Contributor

Thanks @maya-barak for starting this. Listing role assignments from the PDP was a feature worth having. It was finished in #65, and #71 added sync-client support; both shipped in permit 2.4.0. So I'm closing this PR as superseded. The API is:

# async
await permit.pdp_api.role_assignments.list(
    user_key=..., role_key=..., tenant_key=...,
    resource_key=..., resource_instance_key=...,
    page=1, per_page=100,
)  # -> List[RoleAssignment]

# sync (permit.sync.Permit)
permit.pdp_api.role_assignments.list(user_key=...)

It includes the resource filter raised in review, and it returns typed RoleAssignment models instead of raw dicts.

#126, now merged to main and shipping in permit 3.0.0, also fixes two bugs in it: the sync pdp_api client now initializes correctly, and pdp_timeout now applies to permit.pdp_api.* calls. Thanks again!

@zeevmoney zeevmoney closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants