Sha256: 3b72b3a2fe2db4f4403da13cecee7032381f80725ccb90cb5f29e6d85c7e93ff

Contents?: true

Size: 919 Bytes

Versions: 8

Compression:

Stored size: 919 Bytes

Contents

class SpecACLHelper < Zen::Controller::AdminController
  map '/admin/spec-acl-helper'

  # Hash used to store the data in for each spec rather than returning it and
  # having to encode/decode it using Marshal.
  SpecData = {
    :permissions => nil
  }

  # Don't cache the access rules in the session.
  after_all do
    session.delete(:access_rules) if session[:access_rules]
  end

  # returns all permissions
  def index
    SpecData[:permissions] = extension_permissions
  end

  def require_all
    if user_authorized?([:create, :read], true, 'Users::Controller::Users')
      return 'authorized'
    else
      return 'not authorized'
    end
  end

  def require_one
    if user_authorized?([:create, :delete], false, 'Users::Controller::Users')
      return 'authorized'
    else
      return 'not authorized'
    end
  end

  def require_permissions_block
    require_permissions(:delete, :update)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
zen-0.4.3 spec/fixtures/zen/helper/acl.rb
zen-0.4.2 spec/fixtures/zen/helper/acl.rb
zen-0.4.1 spec/fixtures/zen/helper/acl.rb
zen-0.4 spec/fixtures/zen/helper/acl.rb
zen-0.3 spec/fixtures/zen/helper/acl.rb
zen-0.3b1 spec/fixtures/zen/helper/acl.rb
zen-0.3b spec/fixtures/zen/helper/acl.rb
zen-0.2.8 spec/fixtures/zen/helper/acl.rb