Sha256: 3b4976e551bce318ad228f753410b0eb3943716c1d0c8b0dbaee001ca2a41532

Contents?: true

Size: 661 Bytes

Versions: 10

Compression:

Stored size: 661 Bytes

Contents

class SpudPermission

  attr_accessor :tag, :name, :apps

  def initialize(tag, name, apps=nil)
    self.tag = tag
    self.name = name
    self.apps = apps || []
  end

  # Find a permission by tag
  def self.find(tag)
    return TbCore.permissions.find{ |p| p.tag == tag }
  end

  # Returns hash of permissions, grouped by tag namespace
  def self.grouped_by_tag
    return TbCore.permissions.group_by do |p|
      p.tag.split('.').first
    end
  end

  # Returns array permissions sorted by tag
  def self.sorted_by_tag
    return TbCore.permissions.sort_by(&:tag)
  end

  # Returns all permissions
  def self.all
    return TbCore.permissions
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tb_core-1.5.4 app/models/spud_permission.rb
tb_core-1.5.3 app/models/spud_permission.rb
tb_core-1.5.2 app/models/spud_permission.rb
tb_core-1.5.1 app/models/spud_permission.rb
tb_core-1.5.0 app/models/spud_permission.rb
tb_core-1.4.8 app/models/spud_permission.rb
tb_core-1.4.7 app/models/spud_permission.rb
tb_core-1.4.6 app/models/spud_permission.rb
tb_core-1.4.5 app/models/spud_permission.rb
tb_core-1.4.4 app/models/spud_permission.rb