304 response accessing admin url logged in as admin


(Jen) #1

Hi,

In dev mode, I’m trying to access a url in the browser that’s only visible for admins. I’m getting a Oops! That page doesn’t exist or is private. in the frontend, even tho I am logged in as an admin. The logs are throwing a 304 response. I’m not familiar with Ember so I can’t debug if the issue is there. Can someone give me a hand with this please?

This is the code related to it:

Controller :

class DownloadersController < Admin::AdminController
  requires_plugin 'discourse-sync-to-googledrive'

  def index
    google_list = DiscourseDownloadFromDrive::DriveDownloader.new(nil).json_list
    render json: google_list
  end

end

Route:

get "/admin/plugins/discourse-sync-to-googledrive/downloader" => "downloaders#index"

Ember route map:

export default { resource: 'admin.adminPlugins', map() { this.route('discourse-sync-to-googledrive', { resetNamespace: true }, function() { this.route('downloader'); }); } };

Ember route:

import { ajax } from 'discourse/lib/ajax';

export default Ember.Route.extend({
  model() {
    return ajax("/admin/plugins/discourse-sync-to-googledrive/downloader.json");
  }
});

LOGS:

I, [2017-09-05T09:04:43.699690 #10845]  INFO -- : Started GET "/extra-locales/admin" for ::1 at 2017-09-05 09:04:43 +0200
D, [2017-09-05T09:04:43.705422 #10845] DEBUG -- :   UserOption Load (2.7ms)  SELECT  "user_options".* FROM "user_options" WHERE "user_options"."user_id" = 1 LIMIT 1  [["user_id", 1]]
D, [2017-09-05T09:04:43.732613 #10845] DEBUG -- :   UserOption Load (3.6ms)  SELECT  "user_options".* FROM "user_options" WHERE "user_options"."user_id" = 1 LIMIT 1  [["user_id", 1]]
D, [2017-09-05T09:04:43.742188 #10845] DEBUG -- :   UserOption Load (1.2ms)  SELECT  "user_options".* FROM "user_options" WHERE "user_options"."user_id" = 1 LIMIT 1  [["user_id", 1]]
D, [2017-09-05T09:04:43.806084 #10845] DEBUG -- :   Theme Load (1.2ms)  SELECT  "themes".* FROM "themes" WHERE "themes"."color_scheme_id" IS NULL LIMIT 1
D, [2017-09-05T09:04:43.817138 #10845] DEBUG -- :   Theme Load (4.2ms)  SELECT  "themes".* FROM "themes" WHERE "themes"."id" = 2 LIMIT 1  [["id", "2"]]
D, [2017-09-05T09:04:43.825475 #10845] DEBUG -- :   Theme Load (1.9ms)  SELECT  "themes".* FROM "themes" WHERE "themes"."color_scheme_id" IS NULL LIMIT 1
D, [2017-09-05T09:04:43.835408 #10845] DEBUG -- :    (2.4ms)  SELECT "stylesheet_cache"."created_at" FROM "stylesheet_cache" WHERE "stylesheet_cache"."target" = 'admin' AND "stylesheet_cache"."digest" = '8832c23fd65ae3bec4b4a5540dbc9819579e1d4d'  [["target", "admin"], ["digest", "8832c23fd65ae3bec4b4a5540dbc9819579e1d4d"]]
D, [2017-09-05T09:04:43.841650 #10845] DEBUG -- :    (1.5ms)  SELECT "stylesheet_cache"."created_at" FROM "stylesheet_cache" WHERE "stylesheet_cache"."target" = 'desktop_theme_2' AND "stylesheet_cache"."digest" = 'e8ca894d8cb2d1e4fba20190e83be3da2fd6751b'  [["target", "desktop_theme_2"], ["digest", "e8ca894d8cb2d1e4fba20190e83be3da2fd6751b"]]
I, [2017-09-05T09:04:43.907198 #10845]  INFO -- :   Rendered text template (0.0ms)
I, [2017-09-05T09:04:43.924108 #10845]  INFO -- : Processing by ExtraLocalesController#show as */*
I, [2017-09-05T09:04:43.926601 #10845]  INFO -- :   Rendered text template (0.0ms)
D, [2017-09-05T09:04:43.940254 #10845] DEBUG -- :    (1.2ms)  SELECT "stylesheet_cache"."created_at" FROM "stylesheet_cache" WHERE "stylesheet_cache"."target" = 'desktop' AND "stylesheet_cache"."digest" = '8832c23fd65ae3bec4b4a5540dbc9819579e1d4d'  [["target", "desktop"], ["digest", "8832c23fd65ae3bec4b4a5540dbc9819579e1d4d"]]
I, [2017-09-05T09:04:43.942487 #10845]  INFO -- : Completed 304 Not Modified in 342ms (Views: 37.9ms | ActiveRecord: 9.4ms)
I, [2017-09-05T09:04:43.948467 #10845]  INFO -- : Completed 304 Not Modified in 318ms (Views: 19.3ms | ActiveRecord: 12.4ms)
I, [2017-09-05T09:04:43.960358 #10845]  INFO -- :   Parameters: {"bundle"=>"admin"}
I, [2017-09-05T09:04:43.969817 #10845]  INFO -- :   Rendered text template (0.0ms)
I, [2017-09-05T09:04:43.987751 #10845]  INFO -- : Completed 304 Not Modified in 412ms (Views: 15.9ms | ActiveRecord: 19.9ms)
D, [2017-09-05T09:04:43.990724 #10845] DEBUG -- :   UserAuthToken Load (6.1ms)  SELECT  "user_auth_tokens".* FROM "user_auth_tokens" WHERE ((auth_token = '3SDv/Ct6bIs8u9lMYzFAlZjNFVw=' OR
                          prev_auth_token = '3SDv/Ct6bIs8u9lMYzFAlZjNFVw=' OR
                          (auth_token = '13dfae79b07173902c8e7995d438676c' AND legacy)) AND rotated_at > '2017-07-07 07:04:43.983681') LIMIT 1
D, [2017-09-05T09:04:44.025991 #10845] DEBUG -- :   User Load (10.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1  [["id", 1]]
D, [2017-09-05T09:04:44.040488 #10845] DEBUG -- :   UserOption Load (1.9ms)  SELECT  "user_options".* FROM "user_options" WHERE "user_options"."user_id" = 1 LIMIT 1  [["user_id", 1]]
I, [2017-09-05T09:04:44.113604 #10845]  INFO -- :   Rendered text template (0.0ms)
I, [2017-09-05T09:04:44.119780 #10845]  INFO -- : Completed 200 OK in 138ms (Views: 4.5ms | ActiveRecord: 27.6ms)

(Robin Ward) #2

I helped them out with this. In the end the cause was forgetting to do rm -rf tmp after checking out a new branch.


(Robin Ward) #3