Implement RS auth revocation
This commit is contained in:
@@ -3,7 +3,8 @@ class Services::RemotestorageController < Services::BaseController
|
||||
before_action :require_feature_enabled
|
||||
before_action :require_service_available
|
||||
|
||||
def dashboard
|
||||
# Dashboard
|
||||
def show
|
||||
# unless current_user.services_enabled.include?(:remotestorage)
|
||||
# redirect_to service_remotestorage_info_path
|
||||
# end
|
||||
|
||||
34
app/controllers/services/rs_auths_controller.rb
Normal file
34
app/controllers/services/rs_auths_controller.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
class Services::RsAuthsController < Services::BaseController
|
||||
before_action :authenticate_user!
|
||||
before_action :require_feature_enabled
|
||||
before_action :require_service_available
|
||||
# before_action :require_service_enabled
|
||||
|
||||
def destroy
|
||||
if @rs_auth = current_user.remote_storage_authorizations.find(params[:id])
|
||||
@rs_auth.destroy!
|
||||
else
|
||||
http_status :not_found
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html do redirect_to services_storage_url, flash: {
|
||||
success: 'App authorization revoked'
|
||||
}
|
||||
end
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def require_feature_enabled
|
||||
unless Flipper.enabled?(:remotestorage, current_user)
|
||||
http_status :forbidden
|
||||
end
|
||||
end
|
||||
|
||||
def require_service_available
|
||||
http_status :not_found unless Setting.remotestorage_enabled?
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user