From ae7435c78b984301a4e7e663377dfa109af568eb Mon Sep 17 00:00:00 2001 From: Logan Hanks Date: Tue, 11 Sep 2012 14:44:03 -0700 Subject: [PATCH] Apply bearer token before calling controller's pre(). This is necessary to add oauth support to controllers that use c.user to enforce permissions. --- r2/r2/controllers/api.py | 2 +- r2/r2/controllers/listingcontroller.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 8e3f1b652..52cc0883a 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -109,8 +109,8 @@ class ApiController(RedditController, OAuth2ResourceController): """ def pre(self): - RedditController.pre(self) self.check_for_bearer_token() + RedditController.pre(self) @validatedForm() def ajax_login_redirect(self, form, jquery, dest): diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index 3bb1fc0fb..42e2d72c8 100755 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -942,8 +942,8 @@ class MyredditsController(ListingController, OAuth2ResourceController): render_cls = MySubredditsPage def pre(self): - ListingController.pre(self) self.check_for_bearer_token() + ListingController.pre(self) @property def menus(self):