-
Notifications
You must be signed in to change notification settings - Fork 86
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
Role based search results filtering #434
Conversation
…apply default filters not only to public role, but to any role.
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.
@litvinovg I am expecting that VIVO customers would like to open all objects by default, and then just add some exceptions. Can you demonstrate in your test data the scenario that everything is searchable for anonymous user (not logged in), except one type of objects (for instance countries)?
@@ -261,4 +261,10 @@ public enum Precision { | |||
} | |||
public String uri(){return URI;} | |||
} | |||
|
|||
public static final String ROLE_PUBLIC_URI = "http://vitro.mannlib.cornell.edu/ns/vitro/authorization#PUBLIC"; |
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.
Can we use here VITRO_AUTH prefix? One day we might decide to move from Cornell domain in the Vitro application ontology. The same comment is for the next 4 lines.
public static final String ROLE_PUBLIC_URI = "http://vitro.mannlib.cornell.edu/ns/vitro/authorization#PUBLIC"; | |
public static final String ROLE_PUBLIC_URI = VITRO_AUTH + #PUBLIC"; |
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.
Done
To do that one would need to:
I suggest doing this at the stage of preparing documentation for the release. |
I suppose it should be part of this wiki pages - https://wiki.lyrasis.org/display/VIVODOC115x/Authorization. Let's define this scenario in the wiki documentation. |
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.
@litvinovg thanks. Works for me. We need one more review.
@@ -489,9 +497,12 @@ private static void setSelectedFilters(Map<String, SearchFilter> filtersByField, | |||
} | |||
} | |||
|
|||
private static boolean isNotLoggedIn(VitroRequest vreq) { | |||
private static Set<String> getCurrentUserRoles(VitroRequest vreq) { | |||
UserAccount user = LoginStatusBean.getCurrentUser(vreq); |
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.
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.
I don't know. Let's create an issue and discuss it there.
I think it is out of scope for this PR.
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.
Yeah, it is out of scope to some degree. Also, the origins of the beans can be traced back to instantiation. Just not sure of the runtime bytecode modifications between RDF interpolation of Java classes and casting between non concrete classes.
What does this pull request do?
New property will allow users to define filter values that could be used to exclude sensitive or technical information not intended for public display from search results for any user roles defined in VIVO.
What's new?
Replaced search:defaultPublic data property that was used to apply search filters to public role with
search:isDefaultForRole object property to specify role the filtering should be applied to.
How should this be tested?
Additional Notes:
Removed previously mistakenly committed file.
Default roles identifiers moved to VitroVocabulary
Interested parties
@VIVO-project/vivo-committers