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/05/27 23:59:59 UTC

[2/8] git commit: [#7372] ticket:583 List projects that belong to user on disable account page

[#7372] ticket:583 List projects that belong to user on disable account page


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/a6277fbf
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/a6277fbf
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/a6277fbf

Branch: refs/heads/master
Commit: a6277fbfe4d1c4eea29475c359449146b1885705
Parents: c4bc605
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed May 14 11:46:02 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri May 23 18:02:37 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py                 |  6 +++++-
 Allura/allura/templates/user_disable_account.html | 11 +++++++++++
 Allura/allura/tests/functional/test_auth.py       | 10 ++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/a6277fbf/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 6ebf2b0..9d0af06 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -858,4 +858,8 @@ class DisableAccountController(BaseController):
     def index(self, **kw):
         provider = plugin.AuthenticationProvider.get(request)
         menu = provider.account_navigation()
-        return {'menu': menu}
+        my_projects = c.user.my_projects_by_role_name('Admin').all()
+        return {
+            'menu': menu,
+            'my_projects': my_projects,
+        }

http://git-wip-us.apache.org/repos/asf/allura/blob/a6277fbf/Allura/allura/templates/user_disable_account.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_disable_account.html b/Allura/allura/templates/user_disable_account.html
index 6542902..746f1be 100644
--- a/Allura/allura/templates/user_disable_account.html
+++ b/Allura/allura/templates/user_disable_account.html
@@ -27,5 +27,16 @@
   {{ super() }}
   <div class='grid-20'>
     <h2>Disable account</h2>
+    {% if my_projects %}
+    <p>
+      Currently you are an admin of the following projects.
+      These projects would be orphaned unless they have another admin.
+      <ul>
+        {% for p in my_projects %}
+          <li><a href="{{ p.url() }}">{{ p.name }}</a></li>
+        {% endfor %}
+      </ul>
+    </p>
+    {% endif %}
   </div>
 {% endblock %}

http://git-wip-us.apache.org/repos/asf/allura/blob/a6277fbf/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index c4a4f84..f4f773a 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -1038,3 +1038,13 @@ class TestOAuth(TestController):
         atok = parse_qs(r.body)
         assert_equal(len(atok['oauth_token']), 1)
         assert_equal(len(atok['oauth_token_secret']), 1)
+
+
+class TestDisableAccount(TestController):
+
+    def test_lists_user_projects(self):
+        r = self.app.get('/auth/disable/')
+        user = M.User.by_username('test-admin')
+        for p in user.my_projects_by_role_name('Admin'):
+            assert_in(p.name, r)
+            assert_in(p.url(), r)