pundit: now updating maps actually works
This commit is contained in:
parent
5d179ae5ec
commit
bc505a1361
3 changed files with 5 additions and 7 deletions
|
@ -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?
|
||||||
|
|
|
@ -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?
|
||||||
|
|
|
@ -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?
|
||||||
|
|
Loading…
Reference in a new issue