Sha256: 4bd9f13a9c5431129510edae70179c6551423222aaac47746a6e0cb40a4e8ca6

Contents?: true

Size: 365 Bytes

Versions: 4

Compression:

Stored size: 365 Bytes

Contents

class Authorization
  cattr_accessor :permissions

  DEFAULTS = {remove_content: true}

  def self.setup(opts = {})
    opts = {} unless opts
    @@permissions = DEFAULTS.merge(opts)
  end

  def self.authorized_for?(action)
    !!permissions[action]
  end

  def self.execute_if_authorized_for(action)
    yield if authorized_for?(action) && block_given?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redis_monitor-0.3.3 lib/engine/app/lib/security/authorization.rb
redis_monitor-0.3.2 lib/engine/app/lib/security/authorization.rb
redis_monitor-0.3 lib/engine/app/lib/security/authorization.rb
redis_monitor-0.2.1 lib/engine/app/lib/security/authorization.rb