Sha256: 9eacebc4028e63e399edc5e70dfc01efbbb3e96b035debca46ef236a6f98ea43

Contents?: true

Size: 558 Bytes

Versions: 6

Compression:

Stored size: 558 Bytes

Contents

module Fastui
  class Acl
    include Singleton

    def initialize
      @entries = MAclEntry.all
    end

    def allow(aros = "*", acos = "*", permit = "*")
      aros = [aros] unless aros.is_a?(Array)
      acos = [acos] unless acos.is_a?(Array)
      aros.each do |aro|
        acos.each do |aco|
          entry = MAclEntry.first_or_initialize(:aro_type =>aro.class.to_s, :aro_id => aro.id, :aco_type =>aco.class.to_s, :aco_id => aco.id)
          entry.permit = permit
          entry.save
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fastui-0.1.8 app/models/fastui/acl.rb
fastui-0.1.7 app/models/fastui/acl.rb
fastui-0.1.6 app/models/fastui/acl.rb
fastui-0.1.4 app/models/fastui/acl.rb
fastui-0.1.3 app/models/fastui/acl.rb
fastui-0.1.2 app/models/fastui/acl.rb