Sha256: 8f2991209134b52cf1a4e8ed2545f0f310765e098e485e8cdd53f6dbebbe29ae

Contents?: true

Size: 433 Bytes

Versions: 1

Compression:

Stored size: 433 Bytes

Contents

class UserPolicy < ApplicationPolicy
  def show?
    true
  end

  def index?
    true
  end

  def create?
    user_permissions?
  end

  def update?
    user_permissions?
  end

  def delete?
    admin_permissions?
  end

  def update_user_role?
    @user.master?
  end

  private

  def user_permissions?
    @user.user? or @user.admin? or @user.master?
  end

  def admin_permissions?
    @user.master? or @user.admin?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
souls-0.24.2 apps/api/app/policies/user_policy.rb