Skip to content

Commit

Permalink
[#3027] use commit from 3027 and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
k-nut committed Jun 2, 2016
1 parent e171528 commit 7b6dbed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ckan/controllers/user.py
Expand Up @@ -180,7 +180,7 @@ def new(self, data=None, errors=None, error_summary=None):
if context['save'] and not data:
return self._save_new(context)

if c.user and not data:
if c.user and not data and not authz.is_sysadmin(c.user):
# #1799 Don't offer the registration form if already logged in
return render('user/logout_first.html')

Expand Down
10 changes: 10 additions & 0 deletions ckan/tests/controllers/test_user.py
Expand Up @@ -224,6 +224,16 @@ def test_user_edit_not_logged_in(self):
status=403
)

def test_create_user_as_sysadmin(self):
sysadmin = factories.Sysadmin()
app = self._get_test_app()
env = {'REMOTE_USER': sysadmin['name'].encode('ascii')}
response = app.get(
url=url_for(controller='user', action='register'),
extra_environ=env,
)
assert "user-register-form" in response.forms

def test_edit_user(self):
user = factories.User(password='pass')
app = self._get_test_app()
Expand Down

0 comments on commit 7b6dbed

Please sign in to comment.