Skip to content
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

Develop to master merge #163

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -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
@@ -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)

8 changes: 3 additions & 5 deletions helpers/slices_helper.rb
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -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
@@ -21,4 +21,4 @@ def filter_for_user_onts(obj)
end
end

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