pundit: now updating maps actually works
This commit is contained in:
parent
fdd9351378
commit
d0fd676aa0
3 changed files with 5 additions and 7 deletions
|
@ -35,7 +35,6 @@ class MapPolicy < ApplicationPolicy
|
|||
|
||||
def update?
|
||||
user.present? && (record.permission == 'commons' || record.user == user)
|
||||
true
|
||||
end
|
||||
|
||||
def screenshot?
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -7,6 +7,7 @@ class SynapsePolicy < ApplicationPolicy
|
|||
|
||||
def create?
|
||||
user.present?
|
||||
# todo add validation against whether you can see both topics
|
||||
end
|
||||
|
||||
def show?
|
||||
|
|
Loading…
Reference in a new issue