You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/07/18 21:02:12 UTC
[05/28] git commit: [#7484] Changed oauth app names to be unique per
user instead of globally unique
[#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/60f07685
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/60f07685
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/60f07685
Branch: refs/heads/db/7523
Commit: 60f07685bc83a6e04ccd97743cfda526dc5b3121
Parents: 1851fd7
Author: Cory Johns <jo...@gmail.com>
Authored: Sat Jun 28 22:41:00 2014 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jul 8 21:38:05 2014 +0000
----------------------------------------------------------------------
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/60f07685/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/60f07685/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)