You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/06/29 04:42:17 UTC
git commit: [#7484] Changed oauth app names to be unique per user
instead of globally unique
Repository: allura
Updated Branches:
refs/heads/cj/7484 [created] c4edc73f3
[#7484] Changed oauth app names to be unique per user instead of globally unique
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c4edc73f
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c4edc73f
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c4edc73f
Branch: refs/heads/cj/7484
Commit: c4edc73f3bbf3e5deba0749809852cd5de9fd683
Parents: 4cb87bf
Author: Cory Johns <jo...@gmail.com>
Authored: Sat Jun 28 22:41:00 2014 -0400
Committer: Cory Johns <jo...@gmail.com>
Committed: Sat Jun 28 22:41:00 2014 -0400
----------------------------------------------------------------------
Allura/allura/lib/validators.py | 2 +-
Allura/allura/model/oauth.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/c4edc73f/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 805bf31..5f8256f 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -88,7 +88,7 @@ class UniqueOAuthApplicationName(fev.UnicodeString):
def _to_python(self, value, state):
from allura import model as M
- app = M.OAuthConsumerToken.query.get(name=value)
+ app = M.OAuthConsumerToken.query.get(name=value, user_id=c.user._id)
if app is not None:
raise fe.Invalid(
'That name is already taken, please choose another', value, state)
http://git-wip-us.apache.org/repos/asf/allura/blob/c4edc73f/Allura/allura/model/oauth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/oauth.py b/Allura/allura/model/oauth.py
index b09a8ec..fb395f5 100644
--- a/Allura/allura/model/oauth.py
+++ b/Allura/allura/model/oauth.py
@@ -62,7 +62,7 @@ class OAuthConsumerToken(OAuthToken):
class __mongometa__:
polymorphic_identity = 'consumer'
name = 'oauth_consumer_token'
- unique_indexes = ['name']
+ unique_indexes = [('name', 'user_id')]
type = FieldProperty(str, if_missing='consumer')
user_id = AlluraUserProperty(if_missing=lambda: c.user._id)