-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new endpoint checkpermissions #2047
Add new endpoint checkpermissions #2047
Conversation
d9de88f
to
aec95e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @hu-ahmed for the PR.
Functionality already looks good, I had a first look and did some inline comments.
We should definitely add some unit tests as well for this feature (model classes + for the actor + for the HTTP route).
Javadoc has to be added for every public class/method, etc. .. so choose wisely what to make "public" and what not ;)
...vice/src/main/java/org/eclipse/ditto/edge/service/dispatching/EdgeCommandForwarderActor.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/AbstractHttpRequestActor.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/AbstractHttpRequestActor.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/CheckPermissionsActor.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/CheckPermissionsActor.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/ditto/policies/model/signals/commands/query/PolicyCheckPermissionsResponse.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/ditto/policies/model/signals/commands/query/PolicyCheckPermissionsResponse.java
Outdated
Show resolved
Hide resolved
.../policies/service/persistence/actors/strategies/commands/PolicyCheckPermissionsStrategy.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/ditto/policies/model/signals/commands/query/PolicyCheckPermissionsResponse.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/ditto/policies/model/signals/commands/query/PolicyCheckPermissionsResponse.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress, @hu-ahmed - thanks a lot. 👍
I did another round of review and provided feedback inline, please have a look :)
...vice/src/main/java/org/eclipse/ditto/edge/service/dispatching/EdgeCommandForwarderActor.java
Outdated
Show resolved
Hide resolved
...vice/src/main/java/org/eclipse/ditto/edge/service/dispatching/EdgeCommandForwarderActor.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/CheckPermissionsActor.java
Show resolved
Hide resolved
.../src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/CheckPermissionsActor.java
Show resolved
Hide resolved
.../src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/CheckPermissionsActor.java
Outdated
Show resolved
Hide resolved
.../eclipse/ditto/gateway/service/endpoints/routes/checkpermissions/PermissionCheckWrapper.java
Outdated
Show resolved
Hide resolved
.../eclipse/ditto/gateway/service/endpoints/routes/checkpermissions/PermissionCheckWrapper.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/CheckPermissionsActor.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/eclipse/ditto/policies/api/commands/sudo/CheckPolicyPermissionsResponse.java
Outdated
Show resolved
Hide resolved
d6d9d0e
to
7588065
Compare
.../src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/CheckPermissionsActor.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/AbstractHttpRequestActor.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/CheckPermissionsActor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some remarks for the added documentation.
documentation/src/main/resources/pages/ditto/baic-auth-checkpermissions.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/httpapi-concepts.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/httpapi-concepts.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some few minor fixes needed ..
documentation/src/main/resources/pages/ditto/baic-auth-checkpermissions.md
Outdated
Show resolved
Hide resolved
@hu-ahmed changes look good to me 👍 Thanks a lot for your patience. Looking forward to a system test: https://github.com/eclipse-ditto/ditto-testing |
System tests passed: https://github.com/eclipse-ditto/ditto/actions/runs/11667112664/job/32584674693 |
fixes #1137
This PR introduces the implementation of the /checkPermissions endpoint in Ditto’s API, enhancing the authorization model by allowing permission checks on thing, message, and policy resources without modifying them. This endpoint validates whether specified entities have the required permissions for resources, returning authorization statuses in the response. This feature is particularly beneficial for UI-driven applications that rely on dynamic permission-based display logic, where interface elements can be enabled or disabled based on user access rights. Documentation includes usage examples, request structure, and response details.
Example Request
A POST request to /checkPermissions to verify permissions for multiple entities:
Example Response