Sha256: 99c90325ab5d5aa3838c9a5f1709a10fb66c8b024fd30138937d5c5c982c8ede
Contents?: true
Size: 1.03 KB
Versions: 10
Compression:
Stored size: 1.03 KB
Contents
module Tenon class ApplicationPolicy attr_reader :user, :record def initialize(user, record) @user = user @record = record end def index? user.admin? || user.super_admin? || user.contributor? end def show? scope.where(id: record.id).exists? end def create? user.admin? || user.super_admin? || user.contributor? end def new? create? end def update? user.admin? || user.super_admin? || user.contributor? end def edit? update? end def destroy? user.admin? || user.super_admin? || user.contributor? end def reorder? user.admin? || user.super_admin? || user.contributor? end def publish? user.admin? || user.super_admin? end def scope Pundit.policy_scope!(user, record.class) end class Scope attr_reader :user, :scope def initialize(user, scope) @user = user @scope = scope end def resolve scope end end end end
Version data entries
10 entries across 10 versions & 1 rubygems