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?
user.present? && (record.permission == 'commons' || record.user == user)
true
end
def screenshot?

View file

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

View file

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