Install Pundit and add UserPolicy
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
sto
2025-03-22 09:48:40 +01:00
parent 0b47cc4d8a
commit 5472a400d1
6 changed files with 114 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
class UserPolicy < ApplicationPolicy
def index
user.admin?
end
def show?
user.admin? || user.id == record.id
end
def new?
user.admin?
end
def create?
user.admin?
end
def edit?
user.admin? || user.id == record.id
end
def update?
user.admin? || user.id == record.id
end
def destroy?
user.admin?
end
end