Sha256: 4aed898e791c387f69ca0e5fa8ed9de468df6f8031b8e1ae83f8c316892eb0a3
Contents?: true
Size: 735 Bytes
Versions: 2
Compression:
Stored size: 735 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
federails-0.2.0 | app/policies/federails/federails_policy.rb |
federails-0.1.0 | app/policies/federails/federails_policy.rb |