Skip to content
Snippets Groups Projects
Commit e6263b8b authored by Giovanne Marcelo's avatar Giovanne Marcelo
Browse files

Small fix

parent e8adb200
No related branches found
No related tags found
No related merge requests found
......@@ -59,9 +59,9 @@ class Collection < ActiveRecord::Base
end
def user_own?(user)
return false unless user.is_a? User
return user.is_admin? || owner?(user)
return true if user.is_a? Institution and owner.users.include?(user)
return false unless user.is_a? User
user.is_admin? || owner?(user)
end
def private?
......
......@@ -12,9 +12,8 @@ class CollectionPolicy < ApplicationPolicy
end
def resolve
if @user.nil?
scope.where(privacy: 'public')
elsif @user.id == @user_id || @user.is_admin?
if @user.try(:id) == @user_id || @user.try(:is_admin?)
scope.all
else
scope.where(privacy: 'public')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment