class Services::RemotestorageController < Services::BaseController
  before_action :authenticate_user!
  before_action :require_service_available
  before_action :require_feature_enabled

  # Dashboard
  def show
    # unless current_user.services_enabled.include?(:remotestorage)
    #   redirect_to service_remotestorage_info_path
    # end
    @rs_auths = current_user.remote_storage_authorizations
    # TODO sort by app name
  end

  private

    def require_service_available
      http_status :not_found unless Setting.remotestorage_enabled?
    end

    def require_feature_enabled
      unless Flipper.enabled?(:remotestorage, current_user)
        http_status :forbidden
      end
    end
end
