Created
March 21, 2012 12:55
-
-
Save ekampf/2146706 to your computer and use it in GitHub Desktop.
How to limit access to a certain mountable engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CanAccessSomeGem | |
def self.matches?(request) | |
current_user = request.env['warden'].user | |
return false if current_user.blank? | |
return < some condition on current_user > | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :admin do | |
constraints CanAccessSomeGem do | |
mount SomeGem::Engine => "/somegem" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment