annotate rhodecode/controllers/admin/repos_groups.py @ 3705:f37d7514e7ab beta

always use json from compat module
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 07 Apr 2013 19:55:30 +0200
parents 4c78a0855a17
children 7e3d89d9d3a2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1824
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
1 # -*- coding: utf-8 -*-
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
2 """
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
3 rhodecode.controllers.admin.repos_groups
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
5
3410
5f1850e4712a "Users groups" is grammatically incorrect English - rename to "user groups"
Mads Kiilerich <madski@unity3d.com>
parents: 3332
diff changeset
6 Repository groups controller for RhodeCode
1824
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
7
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
8 :created_on: Mar 23, 2010
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
9 :author: marcink
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
11 :license: GPLv3, see COPYING for more details.
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
12 """
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
13 # This program is free software: you can redistribute it and/or modify
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
14 # it under the terms of the GNU General Public License as published by
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
15 # the Free Software Foundation, either version 3 of the License, or
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
16 # (at your option) any later version.
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
17 #
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
18 # This program is distributed in the hope that it will be useful,
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
21 # GNU General Public License for more details.
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
22 #
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
23 # You should have received a copy of the GNU General Public License
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
25
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 import logging
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
27 import traceback
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
28 import formencode
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
29
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
30 from formencode import htmlfill
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
32 from pylons import request, tmpl_context as c, url
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
33 from pylons.controllers.util import abort, redirect
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
34 from pylons.i18n.translation import _
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35
1543
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
36 from sqlalchemy.exc import IntegrityError
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
37
2945
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
38 import rhodecode
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
39 from rhodecode.lib import helpers as h
3705
f37d7514e7ab always use json from compat module
Marcin Kuzminski <marcin@python-works.com>
parents: 3653
diff changeset
40 from rhodecode.lib.compat import json
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
41 from rhodecode.lib.auth import LoginRequired, HasPermissionAnyDecorator,\
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
42 HasReposGroupPermissionAnyDecorator, HasReposGroupPermissionAll,\
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
43 HasPermissionAll
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44 from rhodecode.lib.base import BaseController, render
2945
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
45 from rhodecode.model.db import RepoGroup, Repository
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
46 from rhodecode.model.repos_group import ReposGroupModel
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
47 from rhodecode.model.forms import ReposGroupForm
1734
48d4fcf04a29 another major refactoring with session management
Marcin Kuzminski <marcin@python-works.com>
parents: 1633
diff changeset
48 from rhodecode.model.meta import Session
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
49 from rhodecode.model.repo import RepoModel
2497
5a8c19c4dbe1 Fixed bug in repos group discovery, when inner folder of bare git repos were detected as a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2496
diff changeset
50 from webob.exc import HTTPInternalServerError, HTTPNotFound
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
51 from rhodecode.lib.utils2 import str2bool, safe_int
2945
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
52 from sqlalchemy.sql.expression import func
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
53 from rhodecode.model.scm import GroupList
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
54
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 log = logging.getLogger(__name__)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56
1245
5f2fbab7c429 PEP8ify - controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 1193
diff changeset
57
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
58 class ReposGroupsController(BaseController):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
59 """REST Controller styled on the Atom Publishing Protocol"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
60 # To properly map this controller, ensure your config/routing.py
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
61 # file has a resource setup:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
62 # map.resource('repos_group', 'repos_groups')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
63
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
64 @LoginRequired()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
65 def __before__(self):
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
66 super(ReposGroupsController, self).__before__()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
67
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
68 def __load_defaults(self, allow_empty_group=False, exclude_group_ids=[]):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
69 if HasPermissionAll('hg.admin')('group edit'):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
70 #we're global admin, we're ok and we can create TOP level groups
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
71 allow_empty_group = True
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
72
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
73 #override the choices for this form, we need to filter choices
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
74 #and display only those we have ADMIN right
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
75 groups_with_admin_rights = GroupList(RepoGroup.query().all(),
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
76 perm_set=['group.admin'])
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
77 c.repo_groups = RepoGroup.groups_choices(groups=groups_with_admin_rights,
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
78 show_empty_group=allow_empty_group)
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
79 # exclude filtered ids
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
80 c.repo_groups = filter(lambda x: x[0] not in exclude_group_ids,
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
81 c.repo_groups)
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
82 c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
83 repo_model = RepoModel()
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
84 c.users_array = repo_model.get_users_js()
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
85 c.users_groups_array = repo_model.get_users_groups_js()
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
86
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
87 def __load_data(self, group_id):
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
88 """
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
89 Load defaults settings for edit, and update
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
90
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
91 :param group_id:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
92 """
2496
fddd8e3fc157 use get_or_404 where possible
Marcin Kuzminski <marcin@python-works.com>
parents: 2055
diff changeset
93 repo_group = RepoGroup.get_or_404(group_id)
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
94 data = repo_group.get_dict()
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
95 data['group_name'] = repo_group.name
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
96
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
97 # fill repository users
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
98 for p in repo_group.repo_group_to_perm:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
99 data.update({'u_perm_%s' % p.user.username:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
100 p.permission.permission_name})
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
101
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
102 # fill repository groups
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
103 for p in repo_group.users_group_to_perm:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
104 data.update({'g_perm_%s' % p.users_group.users_group_name:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
105 p.permission.permission_name})
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
106
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
107 return data
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
108
3332
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
109 def _revoke_perms_on_yourself(self, form_result):
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
110 _up = filter(lambda u: c.rhodecode_user.username == u[0],
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
111 form_result['perms_updates'])
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
112 _new = filter(lambda u: c.rhodecode_user.username == u[0],
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
113 form_result['perms_new'])
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
114 if _new and _new[0][1] != 'group.admin' or _up and _up[0][1] != 'group.admin':
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
115 return True
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
116 return False
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
117
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
118 def index(self, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
119 """GET /repos_groups: All items in the collection"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
120 # url('repos_groups')
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
121 group_iter = GroupList(RepoGroup.query().all(), perm_set=['group.admin'])
1898
a7dfe823933a added validation to repo groups to check for conflicting repository name fixes #337
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
122 sk = lambda g: g.parents[0].group_name if g.parents else g.group_name
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
123 c.groups = sorted(group_iter, key=sk)
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
124 return render('admin/repos_groups/repos_groups_show.html')
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
125
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
126 def create(self):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
127 """POST /repos_groups: Create a new item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
128 # url('repos_groups')
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
129
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
130 self.__load_defaults()
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
131
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
132 # permissions for can create group based on parent_id are checked
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
133 # here in the Form
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
134 repos_group_form = ReposGroupForm(available_groups=
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
135 map(lambda k: unicode(k[0]), c.repo_groups))()
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
136 try:
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
137 form_result = repos_group_form.to_python(dict(request.POST))
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
138 ReposGroupModel().create(
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
139 group_name=form_result['group_name'],
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
140 group_description=form_result['group_description'],
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
141 parent=form_result['group_parent_id'],
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
142 owner=self.rhodecode_user.user_id
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
143 )
2662
91c442a489bb sqlalchemy sessions cleanup in admin
Marcin Kuzminski <marcin@python-works.com>
parents: 2631
diff changeset
144 Session().commit()
3653
4c78a0855a17 Fix 'repos group' - it is 'repository group'
Mads Kiilerich <madski@unity3d.com>
parents: 3625
diff changeset
145 h.flash(_('Created repository group %s') \
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
146 % form_result['group_name'], category='success')
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
147 #TODO: in futureaction_logger(, '', '', '', self.sa)
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
148 except formencode.Invalid, errors:
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
149 return htmlfill.render(
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
150 render('admin/repos_groups/repos_groups_add.html'),
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
151 defaults=errors.value,
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
152 errors=errors.error_dict or {},
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
153 prefix_error=False,
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
154 encoding="UTF-8")
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
155 except Exception:
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
156 log.error(traceback.format_exc())
3653
4c78a0855a17 Fix 'repos group' - it is 'repository group'
Mads Kiilerich <madski@unity3d.com>
parents: 3625
diff changeset
157 h.flash(_('Error occurred during creation of repository group %s') \
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
158 % request.POST.get('group_name'), category='error')
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
159 parent_group_id = form_result['group_parent_id']
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
160 #TODO: maybe we should get back to the main view, not the admin one
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
161 return redirect(url('repos_groups', parent_group=parent_group_id))
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
162
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
163 def new(self, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
164 """GET /repos_groups/new: Form to create a new item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
165 # url('new_repos_group')
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
166 if HasPermissionAll('hg.admin')('group create'):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
167 #we're global admin, we're ok and we can create TOP level groups
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
168 pass
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
169 else:
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
170 # we pass in parent group into creation form, thus we know
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
171 # what would be the group, we can check perms here !
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
172 group_id = safe_int(request.GET.get('parent_group'))
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
173 group = RepoGroup.get(group_id) if group_id else None
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
174 group_name = group.group_name if group else None
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
175 if HasReposGroupPermissionAll('group.admin')(group_name, 'group create'):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
176 pass
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
177 else:
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
178 return abort(403)
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
179
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
180 self.__load_defaults()
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
181 return render('admin/repos_groups/repos_groups_add.html')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
182
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
183 @HasReposGroupPermissionAnyDecorator('group.admin')
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
184 def update(self, group_name):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
185 """PUT /repos_groups/group_name: Update an existing item"""
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
186 # Forms posted to this method should contain a hidden field:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
187 # <input type="hidden" name="_method" value="PUT" />
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
188 # Or using helpers:
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
189 # h.form(url('repos_group', group_name=GROUP_NAME),
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
190 # method='put')
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
191 # url('repos_group', group_name=GROUP_NAME)
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
192
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
193 c.repos_group = ReposGroupModel()._get_repos_group(group_name)
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
194 if HasPermissionAll('hg.admin')('group edit'):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
195 #we're global admin, we're ok and we can create TOP level groups
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
196 allow_empty_group = True
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
197 elif not c.repos_group.parent_group:
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
198 allow_empty_group = True
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
199 else:
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
200 allow_empty_group = False
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
201 self.__load_defaults(allow_empty_group=allow_empty_group,
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
202 exclude_group_ids=[c.repos_group.group_id])
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
203
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
204 repos_group_form = ReposGroupForm(
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
205 edit=True,
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
206 old_data=c.repos_group.get_dict(),
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
207 available_groups=c.repo_groups_choices,
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
208 can_create_in_root=allow_empty_group,
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
209 )()
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
210 try:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
211 form_result = repos_group_form.to_python(dict(request.POST))
3332
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
212 if not c.rhodecode_user.is_admin:
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
213 if self._revoke_perms_on_yourself(form_result):
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
214 msg = _('Cannot revoke permission for yourself as admin')
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
215 h.flash(msg, category='warning')
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
216 raise Exception('revoke admin permission on self')
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
217
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
218 new_gr = ReposGroupModel().update(group_name, form_result)
2662
91c442a489bb sqlalchemy sessions cleanup in admin
Marcin Kuzminski <marcin@python-works.com>
parents: 2631
diff changeset
219 Session().commit()
3653
4c78a0855a17 Fix 'repos group' - it is 'repository group'
Mads Kiilerich <madski@unity3d.com>
parents: 3625
diff changeset
220 h.flash(_('Updated repository group %s') \
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
221 % form_result['group_name'], category='success')
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
222 # we now have new name !
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
223 group_name = new_gr.group_name
2820
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
224 #TODO: in future action_logger(, '', '', '', self.sa)
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
225 except formencode.Invalid, errors:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
226
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
227 return htmlfill.render(
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
228 render('admin/repos_groups/repos_groups_edit.html'),
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
229 defaults=errors.value,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
230 errors=errors.error_dict or {},
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
231 prefix_error=False,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
232 encoding="UTF-8")
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
233 except Exception:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
234 log.error(traceback.format_exc())
3653
4c78a0855a17 Fix 'repos group' - it is 'repository group'
Mads Kiilerich <madski@unity3d.com>
parents: 3625
diff changeset
235 h.flash(_('Error occurred during update of repository group %s') \
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
236 % request.POST.get('group_name'), category='error')
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
237
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
238 return redirect(url('edit_repos_group', group_name=group_name))
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
239
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
240 @HasReposGroupPermissionAnyDecorator('group.admin')
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
241 def delete(self, group_name):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
242 """DELETE /repos_groups/group_name: Delete an existing item"""
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
243 # Forms posted to this method should contain a hidden field:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
244 # <input type="hidden" name="_method" value="DELETE" />
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
245 # Or using helpers:
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
246 # h.form(url('repos_group', group_name=GROUP_NAME),
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
247 # method='delete')
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
248 # url('repos_group', group_name=GROUP_NAME)
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
249
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
250 gr = c.repos_group = ReposGroupModel()._get_repos_group(group_name)
1346
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
251 repos = gr.repositories.all()
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
252 if repos:
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
253 h.flash(_('This group contains %s repositores and cannot be '
3458
0ad025ee005e better detection of deleting groups with subgroups inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3410
diff changeset
254 'deleted') % len(repos), category='warning')
0ad025ee005e better detection of deleting groups with subgroups inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3410
diff changeset
255 return redirect(url('repos_groups'))
0ad025ee005e better detection of deleting groups with subgroups inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3410
diff changeset
256
0ad025ee005e better detection of deleting groups with subgroups inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3410
diff changeset
257 children = gr.children.all()
0ad025ee005e better detection of deleting groups with subgroups inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3410
diff changeset
258 if children:
0ad025ee005e better detection of deleting groups with subgroups inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3410
diff changeset
259 h.flash(_('This group contains %s subgroups and cannot be deleted'
0ad025ee005e better detection of deleting groups with subgroups inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3410
diff changeset
260 % (len(children))), category='warning')
1346
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
261 return redirect(url('repos_groups'))
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
262
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
263 try:
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
264 ReposGroupModel().delete(group_name)
2662
91c442a489bb sqlalchemy sessions cleanup in admin
Marcin Kuzminski <marcin@python-works.com>
parents: 2631
diff changeset
265 Session().commit()
3653
4c78a0855a17 Fix 'repos group' - it is 'repository group'
Mads Kiilerich <madski@unity3d.com>
parents: 3625
diff changeset
266 h.flash(_('Removed repository group %s') % group_name,
2749
3ed4dae499d0 Recursive set locking on all children of a group.
Marcin Kuzminski <marcin@python-works.com>
parents: 2662
diff changeset
267 category='success')
1482
a39c0e5fca89 removed obsolete sort code
Marcin Kuzminski <marcin@python-works.com>
parents: 1394
diff changeset
268 #TODO: in future action_logger(, '', '', '', self.sa)
1346
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
269 except Exception:
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
270 log.error(traceback.format_exc())
3565
a8f2d78d14ea consistently capitalize initial letter in flash messages
Mads Kiilerich <madski@unity3d.com>
parents: 3458
diff changeset
271 h.flash(_('Error occurred during deletion of repos '
3458
0ad025ee005e better detection of deleting groups with subgroups inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3410
diff changeset
272 'group %s') % group_name, category='error')
1346
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
273
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
274 return redirect(url('repos_groups'))
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
275
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
276 @HasReposGroupPermissionAnyDecorator('group.admin')
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
277 def delete_repos_group_user_perm(self, group_name):
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
278 """
3410
5f1850e4712a "Users groups" is grammatically incorrect English - rename to "user groups"
Mads Kiilerich <madski@unity3d.com>
parents: 3332
diff changeset
279 DELETE an existing repository group permission user
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
280
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
281 :param group_name:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
282 """
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
283 try:
3332
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
284 if not c.rhodecode_user.is_admin:
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
285 if c.rhodecode_user.user_id == safe_int(request.POST['user_id']):
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
286 msg = _('Cannot revoke permission for yourself as admin')
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
287 h.flash(msg, category='warning')
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
288 raise Exception('revoke admin permission on self')
2820
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
289 recursive = str2bool(request.POST.get('recursive', False))
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
290 ReposGroupModel().delete_permission(
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
291 repos_group=group_name, obj=request.POST['user_id'],
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
292 obj_type='user', recursive=recursive
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
293 )
2662
91c442a489bb sqlalchemy sessions cleanup in admin
Marcin Kuzminski <marcin@python-works.com>
parents: 2631
diff changeset
294 Session().commit()
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
295 except Exception:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
296 log.error(traceback.format_exc())
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
297 h.flash(_('An error occurred during deletion of group user'),
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
298 category='error')
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
299 raise HTTPInternalServerError()
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
300
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
301 @HasReposGroupPermissionAnyDecorator('group.admin')
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
302 def delete_repos_group_users_group_perm(self, group_name):
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
303 """
3410
5f1850e4712a "Users groups" is grammatically incorrect English - rename to "user groups"
Mads Kiilerich <madski@unity3d.com>
parents: 3332
diff changeset
304 DELETE an existing repository group permission user group
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
305
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
306 :param group_name:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
307 """
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
308
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
309 try:
2820
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
310 recursive = str2bool(request.POST.get('recursive', False))
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
311 ReposGroupModel().delete_permission(
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
312 repos_group=group_name, obj=request.POST['users_group_id'],
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
313 obj_type='users_group', recursive=recursive
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
314 )
2662
91c442a489bb sqlalchemy sessions cleanup in admin
Marcin Kuzminski <marcin@python-works.com>
parents: 2631
diff changeset
315 Session().commit()
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
316 except Exception:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
317 log.error(traceback.format_exc())
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
318 h.flash(_('An error occurred during deletion of group'
3410
5f1850e4712a "Users groups" is grammatically incorrect English - rename to "user groups"
Mads Kiilerich <madski@unity3d.com>
parents: 3332
diff changeset
319 ' user groups'),
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
320 category='error')
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
321 raise HTTPInternalServerError()
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
322
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
323 def show_by_name(self, group_name):
2055
c8a8684efc74 fixed issue #370
Marcin Kuzminski <marcin@python-works.com>
parents: 1982
diff changeset
324 """
c8a8684efc74 fixed issue #370
Marcin Kuzminski <marcin@python-works.com>
parents: 1982
diff changeset
325 This is a proxy that does a lookup group_name -> id, and shows
c8a8684efc74 fixed issue #370
Marcin Kuzminski <marcin@python-works.com>
parents: 1982
diff changeset
326 the group by id view instead
c8a8684efc74 fixed issue #370
Marcin Kuzminski <marcin@python-works.com>
parents: 1982
diff changeset
327 """
c8a8684efc74 fixed issue #370
Marcin Kuzminski <marcin@python-works.com>
parents: 1982
diff changeset
328 group_name = group_name.rstrip('/')
2497
5a8c19c4dbe1 Fixed bug in repos group discovery, when inner folder of bare git repos were detected as a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2496
diff changeset
329 id_ = RepoGroup.get_by_group_name(group_name)
5a8c19c4dbe1 Fixed bug in repos group discovery, when inner folder of bare git repos were detected as a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2496
diff changeset
330 if id_:
5a8c19c4dbe1 Fixed bug in repos group discovery, when inner folder of bare git repos were detected as a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2496
diff changeset
331 return self.show(id_.group_id)
5a8c19c4dbe1 Fixed bug in repos group discovery, when inner folder of bare git repos were detected as a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2496
diff changeset
332 raise HTTPNotFound
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
333
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
334 @HasReposGroupPermissionAnyDecorator('group.read', 'group.write',
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1961
diff changeset
335 'group.admin')
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
336 def show(self, group_name, format='html'):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
337 """GET /repos_groups/group_name: Show a specific item"""
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
338 # url('repos_group', group_name=GROUP_NAME)
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
339
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
340 c.group = c.repos_group = ReposGroupModel()._get_repos_group(group_name)
2496
fddd8e3fc157 use get_or_404 where possible
Marcin Kuzminski <marcin@python-works.com>
parents: 2055
diff changeset
341 c.group_repos = c.group.repositories.all()
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
342
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
343 #overwrite our cached list with current filter
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1349
diff changeset
344 gr_filter = c.group_repos
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1349
diff changeset
345 c.repo_cnt = 0
1343
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
346
2831
0959096b2c02 Wraps group listing with permissions check so they don't get displayed
Marcin Kuzminski <marcin@python-works.com>
parents: 2820
diff changeset
347 groups = RepoGroup.query().order_by(RepoGroup.group_name)\
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
348 .filter(RepoGroup.group_parent_id == c.group.group_id).all()
2831
0959096b2c02 Wraps group listing with permissions check so they don't get displayed
Marcin Kuzminski <marcin@python-works.com>
parents: 2820
diff changeset
349 c.groups = self.scm_model.get_repos_groups(groups)
2945
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
350
3625
260a7a01b054 follow Python conventions for boolean values
Mads Kiilerich <madski@unity3d.com>
parents: 3565
diff changeset
351 if not c.visual.lightweight_dashboard:
3167
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 3154
diff changeset
352 c.repos_list = self.scm_model.get_repos(all_repos=gr_filter)
2945
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
353 ## lightweight version of dashboard
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
354 else:
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
355 c.repos_list = Repository.query()\
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
356 .filter(Repository.group_id == c.group.group_id)\
2945
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
357 .order_by(func.lower(Repository.repo_name))\
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
358 .all()
68e95f5ae3a7 lightweight dashboard fix for repos group
Marcin Kuzminski <marcin@python-works.com>
parents: 2831
diff changeset
359
3167
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 3154
diff changeset
360 repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 3154
diff changeset
361 admin=False)
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 3154
diff changeset
362 #json used to render the grid
87258a137018 fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
Marcin Kuzminski <marcin@python-works.com>
parents: 3154
diff changeset
363 c.data = json.dumps(repos_data)
2973
9937afa7f093 whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2945
diff changeset
364
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
365 return render('admin/repos_groups/repos_groups.html')
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
366
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
367 @HasReposGroupPermissionAnyDecorator('group.admin')
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
368 def edit(self, group_name, format='html'):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
369 """GET /repos_groups/group_name/edit: Form to edit an existing item"""
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
370 # url('edit_repos_group', group_name=GROUP_NAME)
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
371
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
372 c.repos_group = ReposGroupModel()._get_repos_group(group_name)
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
373 #we can only allow moving empty group if it's already a top-level
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
374 #group, ie has no parents, or we're admin
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
375 if HasPermissionAll('hg.admin')('group edit'):
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
376 #we're global admin, we're ok and we can create TOP level groups
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
377 allow_empty_group = True
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
378 elif not c.repos_group.parent_group:
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
379 allow_empty_group = True
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
380 else:
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
381 allow_empty_group = False
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
382
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
383 self.__load_defaults(allow_empty_group=allow_empty_group,
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
384 exclude_group_ids=[c.repos_group.group_id])
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3167
diff changeset
385 defaults = self.__load_data(c.repos_group.group_id)
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
386
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
387 return htmlfill.render(
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
388 render('admin/repos_groups/repos_groups_edit.html'),
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
389 defaults=defaults,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
390 encoding="UTF-8",
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
391 force_defaults=False
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
392 )