Sha256: 97244fe4d631f194427f3d17e6bb01c96c7a8b26532c1b9ae2695a5e146c27ab

Contents?: true

Size: 677 Bytes

Versions: 37

Compression:

Stored size: 677 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 Spud::Core.permissions.find{ |p| p.tag == tag }
  end

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

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

  # Returns all permissions
  def self.all
    return Spud::Core.permissions
  end

end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
tb_core-1.4.3.1 app/models/spud_permission.rb
tb_core-1.4.3 app/models/spud_permission.rb
tb_core-1.4.2 app/models/spud_permission.rb
tb_core-1.4.1 app/models/spud_permission.rb
tb_core-1.4.0.1 app/models/spud_permission.rb
tb_core-1.4.beta2 app/models/spud_permission.rb
tb_core-1.4.beta1 app/models/spud_permission.rb
tb_core-1.3.10 app/models/spud_permission.rb
tb_core-1.3.9 app/models/spud_permission.rb
tb_core-1.3.7 app/models/spud_permission.rb
tb_core-1.3.6 app/models/spud_permission.rb
tb_core-1.3.5 app/models/spud_permission.rb
tb_core-1.3.4 app/models/spud_permission.rb
tb_core-1.3.3 app/models/spud_permission.rb
tb_core-1.3.2 app/models/spud_permission.rb
tb_core-1.3.1 app/models/spud_permission.rb
tb_core-1.3.0 app/models/spud_permission.rb
tb_core-1.3.0.beta2 app/models/spud_permission.rb
tb_core-1.3.0.beta1 app/models/spud_permission.rb
tb_core-1.2.8 app/models/spud_permission.rb