Move check_api_readable to api_controller
It's easier to skip the check in the two places that we need to, and include it by default everywhere else.
This commit is contained in:
parent
0bbfe922ea
commit
c1cccd40fc
17 changed files with 5 additions and 18 deletions
|
@ -1,5 +1,7 @@
|
|||
module Api
|
||||
class CapabilitiesController < ApiController
|
||||
skip_before_action :check_api_readable
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
before_action :set_request_formats
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module Api
|
||||
class ChangesetCommentsController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable
|
||||
before_action :authorize
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
module Api
|
||||
class ChangesetsController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable, :only => [:create, :update, :upload, :subscribe, :unsubscribe]
|
||||
before_action :setup_user_auth, :only => [:show]
|
||||
before_action :authorize, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe]
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
module Api
|
||||
class MapController < ApiController
|
||||
before_action :check_api_readable
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
around_action :api_call_handle_error, :api_call_timeout
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
module Api
|
||||
class NodesController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable, :only => [:create, :update, :delete]
|
||||
before_action :authorize, :only => [:create, :update, :delete]
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module Api
|
||||
class NotesController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable, :only => [:create, :comment, :close, :reopen, :destroy]
|
||||
before_action :setup_user_auth, :only => [:create, :show]
|
||||
before_action :authorize, :only => [:close, :reopen, :destroy, :comment]
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# nodes, ways and relations are basically identical.
|
||||
module Api
|
||||
class OldElementsController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable, :only => [:redact]
|
||||
before_action :setup_user_auth, :only => [:history, :show]
|
||||
before_action :authorize, :only => [:redact]
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
module Api
|
||||
class PermissionsController < ApiController
|
||||
before_action :check_api_readable
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
before_action :setup_user_auth
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module Api
|
||||
class RelationsController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable, :only => [:create, :update, :delete]
|
||||
before_action :authorize, :only => [:create, :update, :delete]
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
module Api
|
||||
class TracepointsController < ApiController
|
||||
before_action :check_api_readable
|
||||
|
||||
authorize_resource
|
||||
|
||||
around_action :api_call_handle_error, :api_call_timeout
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module Api
|
||||
class TracesController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable, :only => [:create, :update, :destroy]
|
||||
before_action :set_locale
|
||||
before_action :authorize
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
module Api
|
||||
class UserBlocksController < ApiController
|
||||
before_action :check_api_readable
|
||||
|
||||
authorize_resource
|
||||
|
||||
around_action :api_call_handle_error, :api_call_timeout
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Update and read user preferences, which are arbitrary key/val pairs
|
||||
module Api
|
||||
class UserPreferencesController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable, :only => [:update_all, :update, :destroy]
|
||||
before_action :authorize
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module Api
|
||||
class UsersController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :disable_terms_redirect, :only => [:details]
|
||||
before_action :setup_user_auth, :only => [:show, :index]
|
||||
before_action :authorize, :only => [:details, :gpx_files]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module Api
|
||||
class VersionsController < ApiController
|
||||
skip_before_action :check_api_readable
|
||||
authorize_resource :class => false
|
||||
|
||||
before_action :set_request_formats
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module Api
|
||||
class WaysController < ApiController
|
||||
before_action :check_api_readable
|
||||
before_action :check_api_writable, :only => [:create, :update, :delete]
|
||||
before_action :authorize, :only => [:create, :update, :delete]
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class ApiController < ApplicationController
|
||||
skip_before_action :verify_authenticity_token
|
||||
|
||||
before_action :check_api_readable
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue