Home > subdomain_requirement

subdomain_requirement

Subdomain_requirement is a project mainly written in Ruby, based on the MIT license.

control access to a controller based on the current subdomain. requires subdomain_fu

SubdomainRequirement

account_location or subdomain_fu can help implement subdomain keyed accounts. However, I needed to ensure access to certain controllers were not available except from authorized subdomains.

i.e. keep standard accounts from accessing the subdomain admininstration controllers.

Requirements

This plugin has dependencies on the plugins/gems I'm using in the project that I'm extracting this out of. If need be I'll make the code more generic to not require these dependencies.

subdomain_fu - needs access to current_subdomain

Install

script/plugin install http://github.com/edk/[email protected]:edk/subdomain_requirement.git

Usage

In your controller include SubdomainRequirement:

class ApplicationController < ActionController::Base include SubdomainRequirement [...] end

Putting it in your ApplicationController gives access to all controllers in your system.

To specify a restricted controller:

class Admin::AccountsController < ApplicationController require_subdomain :admin end

Currently there are no options for require_subdomain. But as soon as I come across a need to modify the requirement it can be easily added.

Comments, questions welcome. This is my first publicly released plugin so anything I'm doing which isn't kosher, let me know. email to edk at ixworld.net

Copyright (c) 2009 Eddy Kim, released under the MIT license