pundit: now updating maps actually works

This commit is contained in:
Connor Turland 2016-03-12 11:35:03 +11:00
parent fdd9351378
commit d0fd676aa0
3 changed files with 5 additions and 7 deletions

View file

@ -35,7 +35,6 @@ class MapPolicy < ApplicationPolicy
def update? def update?
user.present? && (record.permission == 'commons' || record.user == user) user.present? && (record.permission == 'commons' || record.user == user)
true
end end
def screenshot? def screenshot?

View file

@ -11,19 +11,17 @@ class MappingPolicy < ApplicationPolicy
end end
def show? def show?
map = policy(record.map, user) map = Pundit.policy(user, record.map)
mappable = policy(record.mappable, user) mappable = Pundit.policy(user, record.mappable)
map.show? && mappable.show? map.show? && mappable.show?
end end
def create? def create?
map = policy(record.map, user) Pundit.policy(user, record.map).update?
map.update?
end end
def update? def update?
map = policy(record.map, user) Pundit.policy(user, record.map).update?
map.update?
end end
def destroy? def destroy?

View file

@ -7,6 +7,7 @@ class SynapsePolicy < ApplicationPolicy
def create? def create?
user.present? user.present?
# todo add validation against whether you can see both topics
end end
def show? def show?