Last active
August 17, 2016 17:41
-
-
Save mjc-gh/0f2d43102b6ecfb2edaa1db82a84c618 to your computer and use it in GitHub Desktop.
Simon Says Authorizer
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 ApplicationController < ActionController::Base | |
include SimonSays::Authorizer | |
self.default_authorization_scope = :current_user | |
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
class DocumentsController < ApplicationController | |
authenticate :user | |
find_and_authorize :documents, :edit, through: :memberships, only: [:edit, :update] | |
find_and_authorize :documents, :delete, through: :memberships, only: :destroy | |
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
class ReportsController < ApplicationController | |
authorize_resource :admin, :support | |
find_resource :report, from: :current_admin, except: [:index, :new, :create] | |
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
resources :documents | |
resources :reports |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment