Created
July 4, 2013 18:59
-
-
Save glaucocustodio/5929646 to your computer and use it in GitHub Desktop.
Doorkepper and CanCan
This file contains 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
# routes | |
use_doorkeeper do | |
controllers :applications => 'custom_applications', | |
:authorized_applications => 'custom_authorized_applications', | |
:authorizations => 'custom_authorizations' | |
end | |
# application | |
config.to_prepare do | |
# Only Applications list | |
Doorkeeper::ApplicationsController.layout "application" | |
# Only Authorization endpoint | |
Doorkeeper::AuthorizationsController.layout "application" | |
# Only Authorized Applications | |
Doorkeeper::AuthorizedApplicationsController.layout "application" | |
end | |
class CustomAuthorizationsController < Doorkeeper::AuthorizationsController | |
include BeforeAction | |
before_action :foo, :bar | |
end | |
class CustomAuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController | |
include BeforeAction | |
# only users signed in with Devise can see authorized apps | |
before_action :authenticate_user!, :foo, :bar | |
# CanCan, the below line generate error, I cant use CanCan?! | |
# authorize_resource | |
end | |
class CustomApplicationsController < Doorkeeper::ApplicationsController | |
include BeforeAction | |
# CanCan, the below line generate error, I cant use CanCan?! | |
#authorize_resource | |
before_action :authenticate_user!, :foo, :bar | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment