-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(search): Add canViewEntityPage permission flag field to search results #15183
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
base: master
Are you sure you want to change the base?
Conversation
Bundle ReportBundle size has no change ✅ |
…w-permission-flag
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…w-permission-flag
…w-permission-flag
…w-permission-flag
|
@yorubaphenom Thanks for the PR, can you add screenshots also depicting before and after state |
datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/mappers/MapperUtils.java
Outdated
Show resolved
Hide resolved
|
Please add unit tests |
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.
We already expose privileges via the EntityPrivilegeResolver. So, it's only a matter of adding the value of AuthUtils.canViewEntity as canViewEntityPage in EntityPrivileges and that should be it. You can then use it like this:
entity {
... on Dataset {
privileges {
canViewEntityPage
}
}
}
That said, VIEW_AUTHORIZATION_ENABLED flag can be used to restrict search results based on available permissions. So this new privilege may not even be necessary unless there is any other use case.
…w-permission-flag
thanks @sakethvarma397 I have implemented your suggestions. The use case for us is on the search page we don't want to show the entity sidebar to users who don't have the viewEntity permissions. |
…w-permission-flag
…w-permission-flag
…w-permission-flag
…w-permission-flag
…w-permission-flag
…w-permission-flag
…w-permission-flag
…w-permission-flag
Adds
canViewEntityPageto theEntityPrivilegesGraphQL type, allowing clients to check entity page view permissions through the standard privileges field instead of relying on search result extraProperties.What Changed
This PR exposes the existing
VIEW_ENTITY_PAGEprivilege through the GraphQLEntityPrivilegestype, making it available via the entity query's privileges field.Changes Made:
canViewEntityPage: Boolean field to GraphQLEntityPrivilegestypeAuthorizationUtils.isViewEntityPageAuthorized()authorization check methodPoliciesConfig.VIEW_ENTITY_PAGE_PRIVILEGEpublic (was package-private)EntityPrivilegesResolver.addCommonPrivileges()to populate the new fieldNow:
Can now check view permissions directly through the entity's privileges field: