Commit 3d7d187f authored by hellekin's avatar hellekin

Fix policies

- Add missing Map policy
- Fix User policy:
  current_user.presence returns an Agent since it is a SimpleDelegator!
- Rename RolesPolicy to RolePolicy
parent ba1d89f2
# frozen_string_literal: true
class MapPolicy < ApplicationPolicy
def index?
true
end
def show?
record_public?
end
class Scope < Scope
def resolve
scope.all
end
end
end
......@@ -2,11 +2,11 @@
class UserPolicy < ApplicationPolicy
def index?
user.presence&.leader? == true
user&.leader? == true
end
def show?
user.presence&.leader? || user.presence.user == record
user&.leader? || user&.user == record
end
class Scope < Scope
......@@ -21,7 +21,7 @@ class UserPolicy < ApplicationPolicy
private
def current_user
user.presence&.user.presence
user&.user&.presence
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment