diff --git a/rhodecode/controllers/admin/user_groups.py b/rhodecode/controllers/admin/user_groups.py --- a/rhodecode/controllers/admin/user_groups.py +++ b/rhodecode/controllers/admin/user_groups.py @@ -36,6 +36,7 @@ from rhodecode.lib import auth from rhodecode.lib import helpers as h from rhodecode.lib.exceptions import UserGroupAssignedException,\ RepoGroupAssignmentError +from rhodecode.lib.utils import jsonify, action_logger from rhodecode.lib.utils2 import safe_unicode, str2bool, safe_int from rhodecode.lib.auth import ( LoginRequired, NotAnonymous, HasUserGroupPermissionAnyDecorator, @@ -181,7 +182,8 @@ class UserGroupsController(BaseControlle h.flash(_('Error occurred during creation of user group %s') \ % request.POST.get('users_group_name'), category='error') - return redirect(url('users_groups')) + return redirect( + url('edit_users_group', user_group_id=user_group.users_group_id)) @HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true') def new(self): @@ -467,5 +469,12 @@ class UserGroupsController(BaseControlle c.group_members_obj = sorted((x.user for x in c.user_group.members), key=lambda u: u.username.lower()) - c.group_members = [(x.user_id, x.username) for x in c.group_members_obj] + group_members = [(x.user_id, x.username) for x in c.group_members_obj] + + if request.is_xhr: + return jsonify(lambda *a, **k: { + 'members': group_members + }) + + c.group_members = group_members return render('admin/user_groups/user_group_edit.html') diff --git a/rhodecode/public/js/src/rhodecode/pyroutes.js b/rhodecode/public/js/src/rhodecode/pyroutes.js --- a/rhodecode/public/js/src/rhodecode/pyroutes.js +++ b/rhodecode/public/js/src/rhodecode/pyroutes.js @@ -14,6 +14,7 @@ function registerRCRoutes() { pyroutes.register('files_home', '/%(repo_name)s/files/%(revision)s/%(f_path)s', ['repo_name', 'revision', 'f_path']); pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']); pyroutes.register('edit_repo_perms', '/%(repo_name)s/settings/permissions', ['repo_name']); + pyroutes.register('edit_user_group_members', '/_admin/user_groups/%(user_group_id)s/edit/members', ['user_group_id']); pyroutes.register('pullrequest_home', '/%(repo_name)s/pull-request/new', ['repo_name']); pyroutes.register('user_autocomplete_data', '/_users', []); pyroutes.register('toggle_following', '/_admin/toggle_following', []); diff --git a/rhodecode/templates/admin/user_groups/user_group_edit_settings.html b/rhodecode/templates/admin/user_groups/user_group_edit_settings.html --- a/rhodecode/templates/admin/user_groups/user_group_edit_settings.html +++ b/rhodecode/templates/admin/user_groups/user_group_edit_settings.html @@ -44,6 +44,9 @@