fix tokens
This commit is contained in:
parent
521aa6b5d0
commit
bf4fbbeb06
2 changed files with 7 additions and 3 deletions
|
@ -5,7 +5,7 @@ class API::RestfulController < ActionController::Base
|
|||
snorlax_used_rest!
|
||||
|
||||
rescue_from(Pundit::NotAuthorizedError) { |e| respond_with_standard_error e, 403 }
|
||||
load_and_authorize_resource except: [:index, :create]
|
||||
load_and_authorize_resource only: [:show, :update, :destroy]
|
||||
|
||||
def create
|
||||
authorize resource_class
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
class Api::TokensController < API::RestfulController
|
||||
|
||||
skip_authorization
|
||||
|
||||
def my_tokens
|
||||
raise Pundit::NotAuthorizedError.new unless current_user
|
||||
instantiate_collection page_collection: false, timeframe_collection: false
|
||||
respond_with_collection
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def resource_serializer
|
||||
"#{resource_name}_serializer".camelize.constantize
|
||||
end
|
||||
|
||||
def visible_records
|
||||
current_user.tokens
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue