Skip to content

feat: add POST method support for single permission checks#31

Merged
zeevmoney merged 10 commits intopermitio:mainfrom
miqdigital:feat/abac-single-permission-check
Feb 8, 2026
Merged

feat: add POST method support for single permission checks#31
zeevmoney merged 10 commits intopermitio:mainfrom
miqdigital:feat/abac-single-permission-check

Conversation

@subash54
Copy link
Contributor

@subash54 subash54 commented Jan 9, 2026

  1. Add optional method: 'GET' | 'POST' parameter to loadLocalState and
    addKeyToState functions, defaulting to GET for backward compatibility.

  2. When POST is used, userAttributes and resourceAttributes are sent in
    the request body, enabling ABAC support for single permission checks
    (consistent with loadLocalStateBulk behavior)

subash54 and others added 2 commits January 9, 2026 21:48
Add optional method parameter to loadLocalState and addKeyToState
functions, defaulting to GET for backward compatibility. When POST
is used, userAttributes and resourceAttributes are sent in the
request body, enabling ABAC support for single permission checks
(consistent with loadLocalStateBulk behavior).
 Add optional method parameter to loadLocalState and addKeyToState
    functions, defaulting to GET for backward compatibility. When POST
    is used, userAttributes and resourceAttributes are sent in the
    request body, enabling ABAC support for single permission checks
    (consistent with loadLocalStateBulk behavior).
Copy link
Contributor

@zeevmoney zeevmoney left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution. Please see the comments and add tests.

@zeevmoney zeevmoney requested a review from Copilot January 12, 2026 18:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds POST method support for single permission checks to enable ABAC (Attribute-Based Access Control) by allowing userAttributes and resourceAttributes to be sent in the request body, consistent with the existing loadLocalStateBulk behavior.

Changes:

  • Added optional method: 'GET' | 'POST' parameter to loadLocalState and addKeyToState functions with GET as default
  • Modified getPermissionFromBE to handle POST requests with attributes in the request body
  • Made userAttributes optional in the addKeyToState interface signature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

subash54 and others added 4 commits January 13, 2026 19:52
- Add HttpMethod type for permission check requests
- Update loadLocalState and addKeyToState to accept optional method parameter
- When POST is used, userAttributes and resourceAttributes are sent in request body
- Refactor POST error handling to use try/catch
- Add tests for POST method functionality
feat: add POST method support for single permission checks
- Added permit.reset() calls in multiple test cases to ensure a clean state before loading local permissions.
- This change improves test reliability by preventing state carryover between tests.
test: reset permit state before loading local state in POST method tests
@subash54 subash54 requested a review from zeevmoney January 13, 2026 16:17
Copy link
Contributor

@zeevmoney zeevmoney left a comment

Choose a reason for hiding this comment

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

Still needs some work, see comments

@zeevmoney zeevmoney requested a review from Copilot January 13, 2026 22:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

subash54 and others added 2 commits January 15, 2026 19:49
…eyToState and getPermissionFromBE

- Updated addKeyToState and getPermissionFromBE functions to accept optional userAttributes and resourceAttributes parameters.
- Default values are now set for userAttributes and resourceAttributes to improve flexibility in permission checks.
- Adjusted related tests to reflect these changes, ensuring compatibility with the new optional parameters.
refactor: make userAttributes and resourceAttributes optional in addK…
@subash54 subash54 requested a review from zeevmoney January 15, 2026 15:09
Copy link
Contributor

@zeevmoney zeevmoney left a comment

Choose a reason for hiding this comment

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

Please fix the API breaking changes.
This API is very old and will be replaced soon, so for now we must maintain the structure.

subash54 and others added 2 commits February 4, 2026 06:51
- Introduced userAttributes as an optional parameter in the Permit interface and related functions to enhance flexibility in permission checks.
- Updated the implementation to utilize finalUserAttributes for permission requests.
- Modified tests to accommodate changes in the addKeyToState function, ensuring compatibility with the new userAttributes structure.
feat: add userAttributes support in Permit and update tests
@subash54 subash54 requested a review from zeevmoney February 4, 2026 01:30
@subash54
Copy link
Contributor Author

subash54 commented Feb 4, 2026

@zeevmoney I have resolved the comment. Please let me know if any other changes are required.

Copy link
Contributor

@zeevmoney zeevmoney left a comment

Choose a reason for hiding this comment

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

Thank you @subash54 !

@zeevmoney zeevmoney merged commit 5be70c6 into permitio:main Feb 8, 2026
1 check passed
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.

2 participants