Skip to content

Commit

Permalink
Merge pull request #163 from ncbo/develop
Browse files Browse the repository at this point in the history
Develop to master merge
  • Loading branch information
alexskr authored Sep 27, 2024
2 parents 81ca033 + 15a5d03 commit 3c78a99
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ def reply(*response)
check_access(obj) if LinkedData.settings.enable_security

# Slice or set check
filter_for_slice(obj) if LinkedData.settings.enable_slices
obj = filter_for_slice(obj) if LinkedData.settings.enable_slices

# Check for custom ontologies set by user
filter_for_user_onts(obj)
obj = filter_for_user_onts(obj)

LinkedData::Serializer.build_response(@env, status: status, ld_object: obj)
end
Expand Down Expand Up @@ -211,8 +211,8 @@ def restricted_ontologies(params=nil)

found_onts = onts.length > 0

filter_for_slice(onts)
filter_for_user_onts(onts)
onts = filter_for_slice(onts)
onts = filter_for_user_onts(onts)
end
onts = filter_access(onts)

Expand Down
8 changes: 3 additions & 5 deletions helpers/slices_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ def filter_for_slice(obj)

slice = current_slice()

if obj.is_a?(Enumerable)
if obj.first.is_a?(LinkedData::Models::Ontology)
obj.delete_if {|o| !slice.ontology_id_set.include?(o.id.to_s)}
end
if obj.is_a?(Enumerable) && obj.first.is_a?(LinkedData::Models::Ontology)
obj = obj.select { |o| slice.ontology_id_set.include?(o.id.to_s) }
end
obj
end
Expand All @@ -35,4 +33,4 @@ def current_slice_acronyms
end
end

helpers Sinatra::Helpers::SlicesHelper
helpers Sinatra::Helpers::SlicesHelper
4 changes: 2 additions & 2 deletions helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def filter_for_user_onts(obj)
user = env["REMOTE_USER"]

if obj.first.is_a?(LinkedData::Models::Ontology)
obj.delete_if {|o| !user.custom_ontology_id_set.include?(o.id.to_s)}
obj = obj.select {|o| user.custom_ontology_id_set.include?(o.id.to_s)}
end

obj
Expand All @@ -21,4 +21,4 @@ def filter_for_user_onts(obj)
end
end

helpers Sinatra::Helpers::UsersHelper
helpers Sinatra::Helpers::UsersHelper

0 comments on commit 3c78a99

Please sign in to comment.