Sha256: b315b2d021c458775ad823b6395ea30c79c18df7ac808c5a2fbac8e0a2a90c89
Contents?: true
Size: 832 Bytes
Versions: 1
Compression:
Stored size: 832 Bytes
Contents
module Federails class FederailsPolicy attr_reader :user, :record def initialize(user, record) @user = user @record = record end def index? true end def show? true end def create? @user.present? end def new? create? end def update? owner? end def edit? update? end def destroy? owner? end class Scope attr_reader :user, :scope def initialize(user, scope) @user = user @scope = scope end def resolve scope.all end end private def owner? return false unless @user @record.actor_id == @user.actor.id end def user_with_actor? @user && Federails.actor_entity?(@user) && !!@user.actor end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
federails-0.3.0 | app/policies/federails/federails_policy.rb |