Fix #5353 - Bug in OAuth which referenced "user"
authorJessica Tallon <tsyesika@tsyesika.se>
Sat, 17 Oct 2015 00:18:32 +0000 (00:18 +0000)
committerJessica Tallon <tsyesika@tsyesika.se>
Sat, 17 Oct 2015 00:18:32 +0000 (00:18 +0000)
There was a recent change in 0f3bf8d where several names which were
used to refer the actor where renamed to the standard "actor"
property name. There were some places in the OAuth decorator and the
OAuth views where the old names were still referred. This fixes that.

mediagoblin/decorators.py
mediagoblin/oauth/oauth.py
mediagoblin/oauth/views.py

index 952b45724b7dbcad02111f6df8965c39bab12133..8874d2a0f9b9436cea58b584a8ff0d0fee98a9a2 100644 (file)
@@ -421,7 +421,7 @@ def oauth_required(controller):
         token = authorization[u"oauth_token"]
         request.access_token = AccessToken.query.filter_by(token=token).first()
         if request.access_token is not None and request.user is None:
-            user_id = request.access_token.user
+            user_id = request.access_token.actor
             request.user = LocalUser.query.filter_by(id=user_id).first()
 
         return controller(request, *args, **kwargs)
index 2cc4e79019a0e331c4061e557b5854661eb14978..f6a1bf4b60d0f2bc63ce592242ef08aaefc68aab 100644 (file)
@@ -46,9 +46,9 @@ class GMGRequestValidator(RequestValidator):
         client_id = self.POST[u"oauth_consumer_key"]
 
         request_token = RequestToken(
-                token=token["oauth_token"],
-                secret=token["oauth_token_secret"],
-                )
+            token=token["oauth_token"],
+            secret=token["oauth_token_secret"],
+        )
         request_token.client = client_id
         if u"oauth_callback" in self.POST:
             request_token.callback = self.POST[u"oauth_callback"]
@@ -63,12 +63,12 @@ class GMGRequestValidator(RequestValidator):
     def save_access_token(self, token, request):
         """ Saves access token in db """
         access_token = AccessToken(
-                token=token["oauth_token"],
-                secret=token["oauth_token_secret"],
+            token=token["oauth_token"],
+            secret=token["oauth_token_secret"],
         )
         access_token.request_token = request.oauth_token
         request_token = RequestToken.query.filter_by(token=request.oauth_token).first()
-        access_token.user = request_token.user
+        access_token.actor = request_token.actor
         access_token.save()
 
     def get_realms(*args, **kwargs):
index 2bfaab3e74ea7734ad3d9e04fc988fff70c63ee1..9d7a877b8fd88b61b9057dbad258ac629861c6e5 100644 (file)
@@ -255,7 +255,7 @@ def authorize(request):
         verifier = auth_endpoint.create_verifier(orequest, {})
         oauth_request.verifier = verifier["oauth_verifier"]
 
-    oauth_request.user = request.user.id
+    oauth_request.actor = request.user.id
     oauth_request.save()
 
     # find client & build context