Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restrict access to items returned by the AdminSetService
- Loading branch information
Showing
4 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
app/search_builders/curation_concerns/admin_set_search_builder.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
module CurationConcerns | ||
class AdminSetSearchBuilder < ::SearchBuilder | ||
def initialize(context, access) | ||
@access = access | ||
super(context) | ||
end | ||
|
||
# This overrides the filter_models in FilterByType | ||
def filter_models(solr_parameters) | ||
solr_parameters[:fq] << ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::AdminSet.to_class_uri) | ||
end | ||
|
||
# Overrides Hydra::AccessControlsEnforcement | ||
def discovery_permissions | ||
if @access == :edit | ||
@discovery_permissions ||= ["edit"] | ||
else | ||
super | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters