Sha256: ed97ec8845401fcafd07318a7e94017a1ab0f80fc263ad08df5f2b05c9d554d6

Contents?: true

Size: 924 Bytes

Versions: 10

Compression:

Stored size: 924 Bytes

Contents

# == Schema Information
#
# Table name: faalis_permissions
#
#  id              :integer          not null, primary key
#  model           :string
#  permission_type :string
#  created_at      :datetime
#  updated_at      :datetime
#

module Faalis
  class Permission < Faalis::ORM.proper_base_class

    if Faalis::ORM.mongoid?
      include Mongoid::Document
      include Mongoid::Timestamps

      field :model, type: String
      field :permission_type, type: String

    end

    has_and_belongs_to_many :groups, class_name: 'Faalis::Group'
    alias_attribute :action, :permission_type

    #alias_method :action, :permission_type

    def to_s
      t('permission_string', action: t(self.permission_type.to_s),
        model: t(self.model.underscore.humanize))
    end

    def id_repr
      "#{self.permission_type.to_s}|#{self.model}"
    end

    def model_name
      model.underscore.humanize
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
faalis-2.0.8 app/models/faalis/permission.rb
faalis-2.0.7 app/models/faalis/permission.rb
faalis-2.0.5 app/models/faalis/permission.rb
faalis-2.0.4 app/models/faalis/permission.rb
faalis-2.0.3 app/models/faalis/permission.rb
faalis-2.0.1 app/models/faalis/permission.rb
faalis-2.0.0 app/models/faalis/permission.rb
faalis-2.0.0.rc6 app/models/faalis/permission.rb
faalis-2.0.0.rc5 app/models/faalis/permission.rb
faalis-2.0.0.rc4 app/models/faalis/permission.rb