class Accessly::Base

Public Class Methods

new(actors) click to toggle source

Create an instance of Accessly::Base. Lookups are cached in inherited object(s) to prevent redundant calls to the database. Pass in a Hash or ActiveRecord::Base for actors if the actor(s) inherit some permissions from other actors in the system. This may happen when you have a user in one or more groups or organizations with their own access control permissions.

@param actors [Hash, ActiveRecord::Base] The actor(s) we're checking permission(s)

# File lib/accessly/base.rb, line 16
def initialize(actors)
  @segment_id = -1
  @actors = case actors
  when Hash
    actors
  else
    { actors.class.name => actors.id }
  end
end

Public Instance Methods

on_segment(segment_id) click to toggle source

@param segment_id [Integer] The segment to further separate permissions requests @return [Accessly::Base] returns the object caller

# File lib/accessly/base.rb, line 28
def on_segment(segment_id)
  @segment_id = segment_id
  self
end