akkounts/app/controllers/services/rs_auths_controller.rb
Râu Cao 713e91a720
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Implement RS auth revocation
2023-11-19 18:49:17 +01:00

35 lines
863 B
Ruby

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