##// END OF EJS Templates
New default permissions definition for user group create
marcink -
r3734:a8f52054 beta
parent child Browse files
Show More
@@ -68,6 +68,15 b' def make_map(config):'
68 68 return is_valid_repos_group(repos_group_name, config['base_path'],
69 69 skip_path_check=True)
70 70
71 def check_user_group(environ, match_dict):
72 """
73 check for valid user group for proper 404 handling
74
75 :param environ:
76 :param match_dict:
77 """
78 return True
79
71 80 def check_int(environ, match_dict):
72 81 return match_dict.get('id').isdigit()
73 82
@@ -266,7 +275,8 b' def make_map(config):'
266 275 m.connect("delete_users_group", "/users_groups/{id}",
267 276 action="delete", conditions=dict(method=["DELETE"]))
268 277 m.connect("edit_users_group", "/users_groups/{id}/edit",
269 action="edit", conditions=dict(method=["GET"]))
278 action="edit", conditions=dict(method=["GET"]),
279 function=check_user_group)
270 280 m.connect("formatted_edit_users_group",
271 281 "/users_groups/{id}.{format}/edit",
272 282 action="edit", conditions=dict(method=["GET"]))
@@ -55,15 +55,19 b' class PermissionsController(BaseControll'
55 55 def __before__(self):
56 56 super(PermissionsController, self).__before__()
57 57
58 self.repo_perms_choices = [('repository.none', _('None'),),
58 c.repo_perms_choices = [('repository.none', _('None'),),
59 59 ('repository.read', _('Read'),),
60 60 ('repository.write', _('Write'),),
61 61 ('repository.admin', _('Admin'),)]
62 self.group_perms_choices = [('group.none', _('None'),),
63 ('group.read', _('Read'),),
64 ('group.write', _('Write'),),
65 ('group.admin', _('Admin'),)]
66 self.register_choices = [
62 c.group_perms_choices = [('group.none', _('None'),),
63 ('group.read', _('Read'),),
64 ('group.write', _('Write'),),
65 ('group.admin', _('Admin'),)]
66 c.user_group_perms_choices = [('usergroup.none', _('None'),),
67 ('usergroup.read', _('Read'),),
68 ('usergroup.write', _('Write'),),
69 ('usergroup.admin', _('Admin'),)]
70 c.register_choices = [
67 71 ('hg.register.none',
68 72 _('Disabled')),
69 73 ('hg.register.manual_activate',
@@ -71,18 +75,17 b' class PermissionsController(BaseControll'
71 75 ('hg.register.auto_activate',
72 76 _('Allowed with automatic account activation')), ]
73 77
74 self.create_choices = [('hg.create.none', _('Disabled')),
75 ('hg.create.repository', _('Enabled'))]
78 c.repo_create_choices = [('hg.create.none', _('Disabled')),
79 ('hg.create.repository', _('Enabled'))]
76 80
77 self.fork_choices = [('hg.fork.none', _('Disabled')),
78 ('hg.fork.repository', _('Enabled'))]
81 c.user_group_create_choices = [('hg.usergroup.create.false', _('Disabled')),
82 ('hg.usergroup.create.true', _('Enabled'))]
79 83
80 # set the global template variables
81 c.repo_perms_choices = self.repo_perms_choices
82 c.group_perms_choices = self.group_perms_choices
83 c.register_choices = self.register_choices
84 c.create_choices = self.create_choices
85 c.fork_choices = self.fork_choices
84 c.repo_group_create_choices = [('hg.repogroup.create.false', _('Disabled')),
85 ('hg.repogroup.create.true', _('Enabled'))]
86
87 c.fork_choices = [('hg.fork.none', _('Disabled')),
88 ('hg.fork.repository', _('Enabled'))]
86 89
87 90 def index(self, format='html'):
88 91 """GET /permissions: All items in the collection"""
@@ -105,23 +108,25 b' class PermissionsController(BaseControll'
105 108 # method='put')
106 109 # url('permission', id=ID)
107 110 if id == 'default':
108 c.user = default_user = User.get_by_username('default')
111 c.user = default_user = User.get_default_user()
109 112 c.perm_user = AuthUser(user_id=default_user.user_id)
110 113 c.user_ip_map = UserIpMap.query()\
111 114 .filter(UserIpMap.user == default_user).all()
112 permission_model = PermissionModel()
113 115
114 116 _form = DefaultPermissionsForm(
115 [x[0] for x in self.repo_perms_choices],
116 [x[0] for x in self.group_perms_choices],
117 [x[0] for x in self.register_choices],
118 [x[0] for x in self.create_choices],
119 [x[0] for x in self.fork_choices])()
117 [x[0] for x in c.repo_perms_choices],
118 [x[0] for x in c.group_perms_choices],
119 [x[0] for x in c.user_group_perms_choices],
120 [x[0] for x in c.repo_create_choices],
121 [x[0] for x in c.repo_group_create_choices],
122 [x[0] for x in c.user_group_create_choices],
123 [x[0] for x in c.fork_choices],
124 [x[0] for x in c.register_choices])()
120 125
121 126 try:
122 127 form_result = _form.to_python(dict(request.POST))
123 128 form_result.update({'perm_user_name': id})
124 permission_model.update(form_result)
129 PermissionModel().update(form_result)
125 130 Session().commit()
126 131 h.flash(_('Default permissions updated successfully'),
127 132 category='success')
@@ -162,24 +167,33 b' class PermissionsController(BaseControll'
162 167
163 168 #this form can only edit default user permissions
164 169 if id == 'default':
165 c.user = default_user = User.get_by_username('default')
166 defaults = {'anonymous': default_user.active}
167 c.perm_user = AuthUser(user_id=default_user.user_id)
170 c.user = User.get_default_user()
171 defaults = {'anonymous': c.user.active}
172 c.perm_user = c.user.AuthUser
168 173 c.user_ip_map = UserIpMap.query()\
169 .filter(UserIpMap.user == default_user).all()
170 for p in default_user.user_perms:
174 .filter(UserIpMap.user == c.user).all()
175 for p in c.user.user_perms:
171 176 if p.permission.permission_name.startswith('repository.'):
172 177 defaults['default_repo_perm'] = p.permission.permission_name
173 178
174 179 if p.permission.permission_name.startswith('group.'):
175 180 defaults['default_group_perm'] = p.permission.permission_name
176 181
182 if p.permission.permission_name.startswith('usergroup.'):
183 defaults['default_user_group_perm'] = p.permission.permission_name
184
185 if p.permission.permission_name.startswith('hg.create.'):
186 defaults['default_repo_create'] = p.permission.permission_name
187
188 if p.permission.permission_name.startswith('hg.repogroup.'):
189 defaults['default_repo_group_create'] = p.permission.permission_name
190
191 if p.permission.permission_name.startswith('hg.usergroup.'):
192 defaults['default_user_group_create'] = p.permission.permission_name
193
177 194 if p.permission.permission_name.startswith('hg.register.'):
178 195 defaults['default_register'] = p.permission.permission_name
179 196
180 if p.permission.permission_name.startswith('hg.create.'):
181 defaults['default_create'] = p.permission.permission_name
182
183 197 if p.permission.permission_name.startswith('hg.fork.'):
184 198 defaults['default_fork'] = p.permission.permission_name
185 199
@@ -98,7 +98,7 b' class ReposController(BaseRepoController'
98 98 choices, c.landing_revs = ScmModel().get_repo_landing_revs(c.repo_info)
99 99 c.landing_revs_choices = choices
100 100
101 c.default_user_id = User.get_by_username('default').user_id
101 c.default_user_id = User.get_default_user().user_id
102 102 c.in_public_journal = UserFollowing.query()\
103 103 .filter(UserFollowing.user_id == c.default_user_id)\
104 104 .filter(UserFollowing.follows_repository == c.repo_info).scalar()
@@ -466,7 +466,7 b' class ReposController(BaseRepoController'
466 466 if cur_token == token:
467 467 try:
468 468 repo_id = Repository.get_by_repo_name(repo_name).repo_id
469 user_id = User.get_by_username('default').user_id
469 user_id = User.get_default_user().user_id
470 470 self.scm_model.toggle_following_repo(repo_id, user_id)
471 471 h.flash(_('Updated repository visibility in public journal'),
472 472 category='success')
@@ -77,7 +77,7 b' class ForksController(BaseRepoController'
77 77 h.not_mapped_error(repo_name)
78 78 return redirect(url('repos'))
79 79
80 c.default_user_id = User.get_by_username('default').user_id
80 c.default_user_id = User.get_default_user().user_id
81 81 c.in_public_journal = UserFollowing.query()\
82 82 .filter(UserFollowing.user_id == c.default_user_id)\
83 83 .filter(UserFollowing.follows_repository == c.repo_info).scalar()
@@ -126,7 +126,7 b' class LoginController(BaseController):'
126 126 @HasPermissionAnyDecorator('hg.admin', 'hg.register.auto_activate',
127 127 'hg.register.manual_activate')
128 128 def register(self):
129 c.auto_active = 'hg.register.auto_activate' in User.get_by_username('default')\
129 c.auto_active = 'hg.register.auto_activate' in User.get_default_user()\
130 130 .AuthUser.permissions['global']
131 131
132 132 if request.POST:
@@ -229,7 +229,7 b' def authenticate(username, password):'
229 229 'lastname': safe_unicode(get_ldap_attr('ldap_attr_lastname')),
230 230 'email': get_ldap_attr('ldap_attr_email'),
231 231 'active': 'hg.register.auto_activate' in User\
232 .get_by_username('default').AuthUser.permissions['global']
232 .get_default_user().AuthUser.permissions['global']
233 233 }
234 234
235 235 # don't store LDAP password since we don't need it. Override
@@ -259,7 +259,7 b' def login_container_auth(username):'
259 259 'lastname': None,
260 260 'email': None,
261 261 'active': 'hg.register.auto_activate' in User\
262 .get_by_username('default').AuthUser.permissions['global']
262 .get_default_user().AuthUser.permissions['global']
263 263 }
264 264 user = UserModel().create_for_container_auth(username, user_attrs)
265 265 if not user:
@@ -521,7 +521,7 b' class DbManage(object):'
521 521 self.sa.add(setting)
522 522
523 523 def fixup_groups(self):
524 def_usr = User.get_by_username('default')
524 def_usr = User.get_default_user()
525 525 for g in RepoGroup.query().all():
526 526 g.group_name = g.get_new_name(g.name)
527 527 self.sa.add(g)
@@ -688,13 +688,8 b' class DbManage(object):'
688 688 """
689 689 # module.(access|create|change|delete)_[name]
690 690 # module.(none|read|write|admin)
691
692 for p in Permission.PERMS:
693 if not Permission.get_by_key(p[0]):
694 new_perm = Permission()
695 new_perm.permission_name = p[0]
696 new_perm.permission_longname = p[0]
697 self.sa.add(new_perm)
691 log.info('creating permissions')
692 PermissionModel(self.sa).create_permissions()
698 693
699 694 def populate_default_permissions(self):
700 695 """
@@ -58,6 +58,7 b' from rhodecode.model.meta import Session'
58 58 from rhodecode.model.repos_group import ReposGroupModel
59 59 from rhodecode.lib.utils2 import safe_str, safe_unicode
60 60 from rhodecode.lib.vcs.utils.fakemod import create_module
61 from rhodecode.model.users_group import UserGroupModel
61 62
62 63 log = logging.getLogger(__name__)
63 64
@@ -100,6 +101,9 b' def repo_name_slug(value):'
100 101 return slug
101 102
102 103
104 #==============================================================================
105 # PERM DECORATOR HELPERS FOR EXTRACTING NAMES FOR PERM CHECKS
106 #==============================================================================
103 107 def get_repo_slug(request):
104 108 _repo = request.environ['pylons.routes_dict'].get('repo_name')
105 109 if _repo:
@@ -116,9 +120,15 b' def get_repos_group_slug(request):'
116 120
117 121 def get_user_group_slug(request):
118 122 _group = request.environ['pylons.routes_dict'].get('id')
119 _group = UserGroup.get(_group)
120 if _group:
121 _group = _group.users_group_name
123 try:
124 _group = UserGroup.get(_group)
125 if _group:
126 _group = _group.users_group_name
127 except Exception:
128 log.debug(traceback.format_exc())
129 #catch all failures here
130 pass
131
122 132 return _group
123 133
124 134
@@ -637,6 +637,7 b' class UserGroup(Base, BaseModel):'
637 637 members = relationship('UserGroupMember', cascade="all, delete, delete-orphan", lazy="joined")
638 638 users_group_to_perm = relationship('UserGroupToPerm', cascade='all')
639 639 users_group_repo_to_perm = relationship('UserGroupRepoToPerm', cascade='all')
640 users_group_repo_group_to_perm = relationship('UserGroupRepoGroupToPerm', cascade='all')
640 641 user_user_group_to_perm = relationship('UserUserGroupToPerm ', cascade='all')
641 642 user = relationship('User')
642 643
@@ -1426,6 +1427,12 b' class Permission(Base, BaseModel):'
1426 1427 ('usergroup.write', _('User group write access')),
1427 1428 ('usergroup.admin', _('User group admin access')),
1428 1429
1430 ('hg.repogroup.create.false', _('Repository Group creation disabled')),
1431 ('hg.repogroup.create.true', _('Repository Group creation enabled')),
1432
1433 ('hg.usergroup.create.false', _('User Group creation disabled')),
1434 ('hg.usergroup.create.true', _('User Group creation enabled')),
1435
1429 1436 ('hg.create.none', _('Repository creation disabled')),
1430 1437 ('hg.create.repository', _('Repository creation enabled')),
1431 1438
@@ -1451,6 +1458,8 b' class Permission(Base, BaseModel):'
1451 1458 ]
1452 1459
1453 1460 # defines which permissions are more important higher the more important
1461 # Weight defines which permissions are more important.
1462 # The higher number the more important.
1454 1463 PERM_WEIGHTS = {
1455 1464 'repository.none': 0,
1456 1465 'repository.read': 1,
@@ -1466,6 +1475,11 b' class Permission(Base, BaseModel):'
1466 1475 'usergroup.read': 1,
1467 1476 'usergroup.write': 3,
1468 1477 'usergroup.admin': 4,
1478 'hg.repogroup.create.false': 0,
1479 'hg.repogroup.create.true': 1,
1480
1481 'hg.usergroup.create.false': 0,
1482 'hg.usergroup.create.true': 1,
1469 1483
1470 1484 'hg.fork.none': 0,
1471 1485 'hg.fork.repository': 1,
@@ -311,7 +311,9 b' def ApplicationUiSettingsForm():'
311 311
312 312
313 313 def DefaultPermissionsForm(repo_perms_choices, group_perms_choices,
314 register_choices, create_choices, fork_choices):
314 user_group_perms_choices, create_choices,
315 repo_group_create_choices, user_group_create_choices,
316 fork_choices, register_choices):
315 317 class _DefaultPermissionsForm(formencode.Schema):
316 318 allow_extra_fields = True
317 319 filter_extra_fields = True
@@ -320,10 +322,14 b' def DefaultPermissionsForm(repo_perms_ch'
320 322 anonymous = v.StringBoolean(if_missing=False)
321 323 default_repo_perm = v.OneOf(repo_perms_choices)
322 324 default_group_perm = v.OneOf(group_perms_choices)
323 default_register = v.OneOf(register_choices)
324 default_create = v.OneOf(create_choices)
325 default_user_group_perm = v.OneOf(user_group_perms_choices)
326
327 default_repo_create = v.OneOf(create_choices)
328 default_user_group_create = v.OneOf(user_group_create_choices)
329 #default_repo_group_create = v.OneOf(repo_group_create_choices) #not impl. yet
325 330 default_fork = v.OneOf(fork_choices)
326 331
332 default_register = v.OneOf(register_choices)
327 333 return _DefaultPermissionsForm
328 334
329 335
@@ -43,6 +43,17 b' class PermissionModel(BaseModel):'
43 43
44 44 cls = Permission
45 45
46 def create_permissions(self):
47 """
48 Create permissions for whole system
49 """
50 for p in Permission.PERMS:
51 if not Permission.get_by_key(p[0]):
52 new_perm = Permission()
53 new_perm.permission_name = p[0]
54 new_perm.permission_longname = p[0] #translation err with p[1]
55 self.sa.add(new_perm)
56
46 57 def create_default_permissions(self, user):
47 58 """
48 59 Creates only missing default permissions for user
@@ -87,6 +98,7 b' class PermissionModel(BaseModel):'
87 98
88 99 # stage 2 reset defaults and set them from form data
89 100 def _make_new(usr, perm_name):
101 log.debug('Creating new permission:%s' % (perm_name))
90 102 new = UserToPerm()
91 103 new.user = usr
92 104 new.permission = Permission.get_by_key(perm_name)
@@ -101,8 +113,11 b' class PermissionModel(BaseModel):'
101 113 self.sa.delete(p)
102 114 #create fresh set of permissions
103 115 for def_perm_key in ['default_repo_perm', 'default_group_perm',
104 'default_register', 'default_create',
105 'default_fork']:
116 'default_user_group_perm',
117 'default_repo_create',
118 #'default_repo_group_create', #not implemented yet
119 'default_user_group_create',
120 'default_fork', 'default_register']:
106 121 p = _make_new(perm_user, form_result[def_perm_key])
107 122 self.sa.add(p)
108 123
@@ -63,7 +63,7 b' class RepoModel(BaseModel):'
63 63 def _create_default_perms(self, repository, private):
64 64 # create default permission
65 65 default = 'repository.read'
66 def_user = User.get_by_username('default')
66 def_user = User.get_default_user()
67 67 for p in def_user.user_perms:
68 68 if p.permission.permission_name.startswith('repository.'):
69 69 default = p.permission.permission_name
@@ -62,7 +62,7 b' class ReposGroupModel(BaseModel):'
62 62 def _create_default_perms(self, new_group):
63 63 # create default permission
64 64 default_perm = 'group.read'
65 def_user = User.get_by_username('default')
65 def_user = User.get_default_user()
66 66 for p in def_user.user_perms:
67 67 if p.permission.permission_name.startswith('group.'):
68 68 default_perm = p.permission.permission_name
@@ -46,7 +46,7 b' class UserGroupModel(BaseModel):'
46 46 def _create_default_perms(self, user_group):
47 47 # create default permission
48 48 default_perm = 'usergroup.read'
49 def_user = User.get_by_username('default')
49 def_user = User.get_default_user()
50 50 for p in def_user.user_perms:
51 51 if p.permission.permission_name.startswith('usergroup.'):
52 52 default_perm = p.permission.permission_name
@@ -66,18 +66,32 b''
66 66 </div>
67 67 <div class="field">
68 68 <div class="label">
69 <label for="default_register">${_('Registration')}:</label>
69 <label for="default_group_perm">${_('User group')}:</label>
70 70 </div>
71 71 <div class="select">
72 ${h.select('default_register','',c.register_choices)}
72 ${h.select('default_user_group_perm','',c.user_group_perms_choices)}
73 ${h.checkbox('overwrite_default_user_group','true')}
74 <label for="overwrite_default_user_group">
75 <span class="tooltip"
76 title="${h.tooltip(_('All default permissions on each user group will be reset to chosen permission, note that all custom default permission on repository groups will be lost'))}">
77 ${_('Overwrite existing settings')}</span> </label>
78
73 79 </div>
74 80 </div>
75 81 <div class="field">
76 82 <div class="label">
77 <label for="default_create">${_('Repository creation')}:</label>
83 <label for="default_repo_create">${_('Repository creation')}:</label>
78 84 </div>
79 85 <div class="select">
80 ${h.select('default_create','',c.create_choices)}
86 ${h.select('default_repo_create','',c.repo_create_choices)}
87 </div>
88 </div>
89 <div class="field">
90 <div class="label">
91 <label for="default_user_group_create">${_('User group creation')}:</label>
92 </div>
93 <div class="select">
94 ${h.select('default_user_group_create','',c.user_group_create_choices)}
81 95 </div>
82 96 </div>
83 97 <div class="field">
@@ -88,6 +102,14 b''
88 102 ${h.select('default_fork','',c.fork_choices)}
89 103 </div>
90 104 </div>
105 <div class="field">
106 <div class="label">
107 <label for="default_register">${_('Registration')}:</label>
108 </div>
109 <div class="select">
110 ${h.select('default_register','',c.register_choices)}
111 </div>
112 </div>
91 113 <div class="buttons">
92 114 ${h.submit('save',_('Save'),class_="ui-btn large")}
93 115 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
@@ -104,7 +126,8 b''
104 126 </div>
105 127
106 128 ## permissions overview
107 <%include file="/base/perms_summary.html"/>
129 <%namespace name="p" file="/base/perms_summary.html"/>
130 ${p.perms_summary(c.perm_user.permissions)}
108 131
109 132 </div>
110 133 <div class="box box-left" style="clear:left">
@@ -28,7 +28,9 b''
28 28 </ul>
29 29 </div>
30 30 <!-- end box / title -->
31
31 32 <div class="table">
33 %if c.users_groups_list:
32 34 <table class="table_disp">
33 35 <tr class="header">
34 36 <th class="left">${_('Group name')}</th>
@@ -55,6 +57,9 b''
55 57 </tr>
56 58 %endfor
57 59 </table>
60 %else:
61 ${_('There are no user groups yet')}
62 %endif
58 63 </div>
59 64 </div>
60 65 </%def>
@@ -9,28 +9,32 b''
9 9 %else:
10 10 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
11 11 <table id="tbl_list_${section}">
12 <thead>
13 <tr>
14 <th class="left">${_('Name')}</th>
15 <th class="left">${_('Permission')}</th>
16 <th class="left">${_('Edit Permission')}</th>
17 </thead>
18 <tbody>
19 12 %if section == 'global':
13 <thead>
14 <tr>
15 <th colspan="2" class="left">${_('Permission')}</th>
16 <th class="left">${_('Edit Permission')}</th>
17 </thead>
18 <tbody>
20 19 %for k in sorted(permissions[section], key=lambda s: s.lower()):
21 20 <tr>
22 <td>
21 <td colspan="2">
23 22 ${h.get_permission_name(k)}
24 23 </td>
25 24 <td>
26 ${h.boolicon(k.split('.')[-1] != 'none')}
27 </td>
28 <td>
29 25 <a href="${h.url('edit_permission', id='default')}">${_('edit')}</a>
30 26 </td>
31 27 </tr>
32 28 %endfor
29 </tbody>
33 30 %else:
31 <thead>
32 <tr>
33 <th class="left">${_('Name')}</th>
34 <th class="left">${_('Permission')}</th>
35 <th class="left">${_('Edit Permission')}</th>
36 </thead>
37 <tbody>
34 38 %for k, section_perm in sorted(permissions[section].items(), key=lambda s: s[1]+s[0].lower()):
35 39 <tr>
36 40 <td>
@@ -38,6 +42,9 b''
38 42 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
39 43 %elif section == 'repositories_groups':
40 44 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
45 %elif section == 'user_groups':
46 ##<a href="${h.url('edit_users_group',id=k)}">${k}</a>
47 ${k}
41 48 %endif
42 49 </td>
43 50 <td>
@@ -48,13 +55,14 b''
48 55 <a href="${h.url('edit_repo',repo_name=k,anchor='permissions_manage')}">${_('edit')}</a>
49 56 %elif section == 'repositories_groups':
50 57 <a href="${h.url('edit_repos_group',group_name=k,anchor='permissions_manage')}">${_('edit')}</a>
58 %elif section == 'user_groups':
59 ##<a href="${h.url('edit_users_group',id=k)}">${_('edit')}</a>
51 60 %endif
52 61 </td>
53 62 </tr>
54 63 %endfor
64 </tbody>
55 65 %endif
56
57 </tbody>
58 66 </table>
59 67 </div>
60 68 %endif
@@ -21,4 +21,4 b''
21 21 <div class="pagination-wh pagination-left">
22 22 ${c.pullrequests_pager.pager('$link_previous ~2~ $link_next')}
23 23 </div>
24 </div> No newline at end of file
24 </div>
@@ -33,7 +33,7 b' merge" class="tooltip" href="/vcs_test_h'
33 33 )
34 34
35 35 def test_repo_summary_with_anonymous_access_disabled(self):
36 anon = User.get_by_username('default')
36 anon = User.get_default_user()
37 37 anon.active = False
38 38 Session().add(anon)
39 39 Session().commit()
@@ -45,13 +45,13 b' merge" class="tooltip" href="/vcs_test_h'
45 45 assert 'login' in response.location
46 46
47 47 finally:
48 anon = User.get_by_username('default')
48 anon = User.get_default_user()
49 49 anon.active = True
50 50 Session().add(anon)
51 51 Session().commit()
52 52
53 53 def test_index_with_anonymous_access_disabled(self):
54 anon = User.get_by_username('default')
54 anon = User.get_default_user()
55 55 anon.active = False
56 56 Session().add(anon)
57 57 Session().commit()
@@ -61,7 +61,7 b' merge" class="tooltip" href="/vcs_test_h'
61 61 status=302)
62 62 assert 'login' in response.location
63 63 finally:
64 anon = User.get_by_username('default')
64 anon = User.get_default_user()
65 65 anon.active = True
66 66 Session().add(anon)
67 67 Session().commit()
@@ -34,7 +34,7 b' class TestPermissions(unittest.TestCase)'
34 34 username=u'u3', password=u'qweqwe',
35 35 email=u'u3@rhodecode.org', firstname=u'u3', lastname=u'u3'
36 36 )
37 self.anon = User.get_by_username('default')
37 self.anon = User.get_default_user()
38 38 self.a1 = UserModel().create_or_update(
39 39 username=u'a1', password=u'qweqwe',
40 40 email=u'a1@rhodecode.org', firstname=u'a1', lastname=u'a1', admin=True
General Comments 0
You need to be logged in to leave comments. Login now