##// END OF EJS Templates
repo group: introduce editing of owner...
Mads Kiilerich -
r8734:abc29122 stable
parent child Browse files
Show More
@@ -76,6 +76,7 b' class RepoGroupsController(base.BaseCont'
76 repo_group = db.RepoGroup.get_or_404(group_id)
76 repo_group = db.RepoGroup.get_or_404(group_id)
77 data = repo_group.get_dict()
77 data = repo_group.get_dict()
78 data['group_name'] = repo_group.name
78 data['group_name'] = repo_group.name
79 data['owner'] = repo_group.owner.username
79
80
80 # fill repository group users
81 # fill repository group users
81 for p in repo_group.repo_group_to_perm:
82 for p in repo_group.repo_group_to_perm:
@@ -146,7 +147,7 b' class RepoGroupsController(base.BaseCont'
146 group_name=form_result['group_name'],
147 group_name=form_result['group_name'],
147 group_description=form_result['group_description'],
148 group_description=form_result['group_description'],
148 parent=form_result['parent_group_id'],
149 parent=form_result['parent_group_id'],
149 owner=request.authuser.user_id, # TODO: make editable
150 owner=request.authuser.user_id,
150 copy_permissions=form_result['group_copy_permissions']
151 copy_permissions=form_result['group_copy_permissions']
151 )
152 )
152 meta.Session().commit()
153 meta.Session().commit()
@@ -173,6 +173,7 b' def RepoGroupForm(edit=False, old_data=N'
173 group_copy_permissions = v.StringBoolean(if_missing=False)
173 group_copy_permissions = v.StringBoolean(if_missing=False)
174
174
175 if edit:
175 if edit:
176 owner = All(v.UnicodeString(not_empty=True), v.ValidRepoUser())
176 # FIXME: do a special check that we cannot move a group to one of
177 # FIXME: do a special check that we cannot move a group to one of
177 # its children
178 # its children
178 pass
179 pass
@@ -281,6 +281,8 b' class RepoGroupModel(object):'
281 old_path = repo_group.full_path
281 old_path = repo_group.full_path
282
282
283 # change properties
283 # change properties
284 if 'owner' in repo_group_args:
285 repo_group.owner = db.User.get_by_username(repo_group_args['owner'])
284 if 'group_description' in repo_group_args:
286 if 'group_description' in repo_group_args:
285 repo_group.group_description = repo_group_args['group_description']
287 repo_group.group_description = repo_group_args['group_description']
286 if 'parent_group_id' in repo_group_args:
288 if 'parent_group_id' in repo_group_args:
@@ -9,6 +9,13 b''
9 </div>
9 </div>
10
10
11 <div class="form-group">
11 <div class="form-group">
12 <label class="control-label" for="owner">${_('Owner')}:</label>
13 <div>
14 ${h.text('owner',class_='form-control', placeholder=_('Type name of user'))}
15 </div>
16 </div>
17
18 <div class="form-group">
12 <label class="control-label" for="group_description">${_('Description')}:</label>
19 <label class="control-label" for="group_description">${_('Description')}:</label>
13 <div>
20 <div>
14 ${h.textarea('group_description',cols=23,rows=5,class_='form-control')}
21 ${h.textarea('group_description',cols=23,rows=5,class_='form-control')}
@@ -47,5 +54,6 b''
47 $("#parent_group_id").select2({
54 $("#parent_group_id").select2({
48 'dropdownAutoWidth': true
55 'dropdownAutoWidth': true
49 });
56 });
57 SimpleUserAutoComplete($('#owner'));
50 });
58 });
51 </script>
59 </script>
@@ -1851,7 +1851,7 b' class _BaseTestApi(object):'
1851 self._compare_error(id_, expected, given=response.body)
1851 self._compare_error(id_, expected, given=response.body)
1852
1852
1853 @base.parametrize('changing_attr,updates', [
1853 @base.parametrize('changing_attr,updates', [
1854 #('owner', {'owner': base.TEST_USER_REGULAR_LOGIN}), # currently broken
1854 ('owner', {'owner': base.TEST_USER_REGULAR_LOGIN}),
1855 ('description', {'description': 'new description'}),
1855 ('description', {'description': 'new description'}),
1856 ('group_name', {'group_name': 'new_repo_name'}),
1856 ('group_name', {'group_name': 'new_repo_name'}),
1857 ('parent', {'parent': 'test_group_for_update'}),
1857 ('parent', {'parent': 'test_group_for_update'}),
@@ -53,6 +53,7 b' class TestRepoGroupsController(base.Test'
53 # edit
53 # edit
54 response = self.app.post(base.url('update_repos_group', group_name=group_name),
54 response = self.app.post(base.url('update_repos_group', group_name=group_name),
55 {'group_name': group_name,
55 {'group_name': group_name,
56 'owner': base.TEST_USER_REGULAR2_LOGIN,
56 'group_description': 'lolo',
57 'group_description': 'lolo',
57 '_session_csrf_secret_token': self.session_csrf_secret_token()})
58 '_session_csrf_secret_token': self.session_csrf_secret_token()})
58 self.checkSessionFlash(response, 'Updated repository group %s' % group_name)
59 self.checkSessionFlash(response, 'Updated repository group %s' % group_name)
General Comments 0
You need to be logged in to leave comments. Login now