user policy to allow profile edits
This commit is contained in:
@ -3,9 +3,10 @@ class UserPolicy < ApplicationPolicy
|
||||
# User Access Policy
|
||||
#
|
||||
# Only Admins can view, create, or update, users
|
||||
# All other users can only access themselves (profile interface)
|
||||
|
||||
def view?
|
||||
user.admin? && show?
|
||||
user.admin? || user == record
|
||||
end
|
||||
|
||||
def create?
|
||||
@ -13,7 +14,7 @@ class UserPolicy < ApplicationPolicy
|
||||
end
|
||||
|
||||
def update?
|
||||
user.admin?
|
||||
user.admin? || user == record
|
||||
end
|
||||
|
||||
class Scope < Scope
|
||||
|
Reference in New Issue
Block a user