You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/04/30 21:26:34 UTC
[1/3] git commit: [#6179] ignore the u/ prefix of user-projects so
that a 15-char username can have their user project created successfully
Updated Branches:
refs/heads/master 5c8db5459 -> 50f9a49f4
[#6179] ignore the u/ prefix of user-projects so that a 15-char username can have their user project created successfully
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f7461097
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f7461097
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f7461097
Branch: refs/heads/master
Commit: f7461097b15347cb3ae196fd0e486844d017e381
Parents: 5c8db54
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Apr 30 18:16:50 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Apr 30 18:16:50 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/plugin.py | 4 ++-
Allura/allura/tests/test_plugin.py | 40 +++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f7461097/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index b7722d2..02aae3a 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -464,7 +464,9 @@ class ProjectRegistrationProvider(object):
self.rate_limit(user, neighborhood)
- if not h.re_project_name.match(shortname.replace('/', '')):
+ if user_project and shortname.startswith('u/'):
+ shortname = shortname.replace('u/', '', 1)
+ if not h.re_project_name.match(shortname):
raise ValueError('Invalid project shortname: %s' % shortname)
p = M.Project.query.get(shortname=shortname, neighborhood_id=neighborhood._id)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f7461097/Allura/allura/tests/test_plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_plugin.py b/Allura/allura/tests/test_plugin.py
new file mode 100644
index 0000000..6e1a07a
--- /dev/null
+++ b/Allura/allura/tests/test_plugin.py
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from nose.tools import assert_equals
+from mock import MagicMock, patch
+
+from allura import model as M
+from allura.lib.utils import TruthyCallable
+from allura.lib.plugin import ProjectRegistrationProvider
+
+
+class TestProjectRegistrationProvider(object):
+
+ @patch('allura.lib.security.has_access')
+ def test_validate_project_15char_user(self, has_access):
+ has_access.return_value = TruthyCallable(lambda: True)
+ provider = ProjectRegistrationProvider()
+ nbhd = M.Neighborhood()
+ provider.validate_project(
+ neighborhood=nbhd,
+ shortname='u/' + ('a' * 15),
+ project_name='15 char username',
+ user=MagicMock(),
+ user_project=True,
+ private_project=False,
+ )
\ No newline at end of file
[3/3] git commit: [#6179] Fix openid user creation
Posted by tv...@apache.org.
[#6179] Fix openid user creation
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/50f9a49f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/50f9a49f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/50f9a49f
Branch: refs/heads/master
Commit: 50f9a49f435f26a0eb32a9ec997683a7eb24a9e0
Parents: 3d3f199
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Apr 30 19:25:37 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Apr 30 19:25:37 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/50f9a49f/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index a792bb9..4dc83e7 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -188,7 +188,7 @@ class AuthController(BaseController):
c.user.set_pref('display_name', display_name)
if u is None:
n = M.Neighborhood.query.get(name='Users')
- n.register_project('u/' + username)
+ n.register_project('u/' + username, user_project=True)
flash('Your username has been set to %s.' % username)
redirect('/')
[2/3] git commit: [#6179] don't change 'shortname' var
Posted by tv...@apache.org.
[#6179] don't change 'shortname' var
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3d3f1997
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3d3f1997
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3d3f1997
Branch: refs/heads/master
Commit: 3d3f199782450d1c497a8146528dfe17b2f8c62f
Parents: f746109
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Apr 30 18:30:58 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Apr 30 18:30:58 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/plugin.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3d3f1997/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 02aae3a..3bb1655 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -465,8 +465,10 @@ class ProjectRegistrationProvider(object):
self.rate_limit(user, neighborhood)
if user_project and shortname.startswith('u/'):
- shortname = shortname.replace('u/', '', 1)
- if not h.re_project_name.match(shortname):
+ check_shortname = shortname.replace('u/', '', 1)
+ else:
+ check_shortname = shortname
+ if not h.re_project_name.match(check_shortname):
raise ValueError('Invalid project shortname: %s' % shortname)
p = M.Project.query.get(shortname=shortname, neighborhood_id=neighborhood._id)