Show More
@@ -54,21 +54,21 b' class TestPermissions(object):' | |||||
54 | # TODO: User creation is a duplicate of test_nofitications, check |
|
54 | # TODO: User creation is a duplicate of test_nofitications, check | |
55 | # if that can be unified |
|
55 | # if that can be unified | |
56 | self.u1 = UserModel().create_or_update( |
|
56 | self.u1 = UserModel().create_or_update( | |
57 |
username= |
|
57 | username='u1', password='qweqwe', | |
58 |
email= |
|
58 | email='u1@rhodecode.org', firstname='u1', lastname='u1' | |
59 | ) |
|
59 | ) | |
60 | self.u2 = UserModel().create_or_update( |
|
60 | self.u2 = UserModel().create_or_update( | |
61 |
username= |
|
61 | username='u2', password='qweqwe', | |
62 |
email= |
|
62 | email='u2@rhodecode.org', firstname='u2', lastname='u2' | |
63 | ) |
|
63 | ) | |
64 | self.u3 = UserModel().create_or_update( |
|
64 | self.u3 = UserModel().create_or_update( | |
65 |
username= |
|
65 | username='u3', password='qweqwe', | |
66 |
email= |
|
66 | email='u3@rhodecode.org', firstname='u3', lastname='u3' | |
67 | ) |
|
67 | ) | |
68 | self.anon = User.get_default_user() |
|
68 | self.anon = User.get_default_user() | |
69 | self.a1 = UserModel().create_or_update( |
|
69 | self.a1 = UserModel().create_or_update( | |
70 |
username= |
|
70 | username='a1', password='qweqwe', | |
71 |
email= |
|
71 | email='a1@rhodecode.org', firstname='a1', lastname='a1', | |
72 | admin=True |
|
72 | admin=True | |
73 | ) |
|
73 | ) | |
74 | Session().commit() |
|
74 | Session().commit() | |
@@ -180,12 +180,11 b' class TestPermissions(object):' | |||||
180 | repo_type='hg', |
|
180 | repo_type='hg', | |
181 | repo_group=self.g1, |
|
181 | repo_group=self.g1, | |
182 | cur_user=self.u1,) |
|
182 | cur_user=self.u1,) | |
183 |
assert repo_perms(self.anon) == |
|
183 | assert repo_perms(self.anon)[repo_name_in_group] == 'repository.read' | |
184 | repo_name_in_group: 'repository.read', |
|
184 | assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read' | |
185 |
|
|
185 | assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read' | |
186 |
|
|
186 | assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read' | |
187 | 'vcs_test_svn': 'repository.read', |
|
187 | ||
188 | } |
|
|||
189 | # Now change default user permissions |
|
188 | # Now change default user permissions | |
190 | new_perm = 'repository.write' |
|
189 | new_perm = 'repository.write' | |
191 | perm_updates = [ |
|
190 | perm_updates = [ | |
@@ -195,12 +194,10 b' class TestPermissions(object):' | |||||
195 | repo_group=self.g1, perm_updates=perm_updates, recursive='all') |
|
194 | repo_group=self.g1, perm_updates=perm_updates, recursive='all') | |
196 |
|
195 | |||
197 | Session().commit() |
|
196 | Session().commit() | |
198 |
assert repo_perms(self.anon) == |
|
197 | assert repo_perms(self.anon)[repo_name_in_group] == new_perm | |
199 | repo_name_in_group: new_perm, |
|
198 | assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read' | |
200 |
|
|
199 | assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read' | |
201 |
|
|
200 | assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read' | |
202 | 'vcs_test_svn': 'repository.read', |
|
|||
203 | } |
|
|||
204 |
|
201 | |||
205 | # NOW MARK repo as private |
|
202 | # NOW MARK repo as private | |
206 | changes = { |
|
203 | changes = { | |
@@ -211,12 +208,10 b' class TestPermissions(object):' | |||||
211 | Session().commit() |
|
208 | Session().commit() | |
212 |
|
209 | |||
213 | # Private repo sets 'none' permission for default user |
|
210 | # Private repo sets 'none' permission for default user | |
214 |
assert repo_perms(self.anon) == |
|
211 | assert repo_perms(self.anon)[repo_name_in_group] == 'repository.none' | |
215 | repo_name_in_group: 'repository.none', |
|
212 | assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read' | |
216 |
|
|
213 | assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read' | |
217 |
|
|
214 | assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read' | |
218 | 'vcs_test_svn': 'repository.read', |
|
|||
219 | } |
|
|||
220 |
|
215 | |||
221 | # apply same logic of "updated" recursive, but now the anon permissions should be not be impacted |
|
216 | # apply same logic of "updated" recursive, but now the anon permissions should be not be impacted | |
222 | new_perm = 'repository.write' |
|
217 | new_perm = 'repository.write' | |
@@ -227,12 +222,10 b' class TestPermissions(object):' | |||||
227 | repo_group=self.g1, perm_updates=perm_updates, recursive='all') |
|
222 | repo_group=self.g1, perm_updates=perm_updates, recursive='all') | |
228 |
|
223 | |||
229 | Session().commit() |
|
224 | Session().commit() | |
230 |
assert repo_perms(self.anon) == |
|
225 | assert repo_perms(self.anon)[repo_name_in_group] == 'repository.none' | |
231 | repo_name_in_group: 'repository.none', |
|
226 | assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read' | |
232 |
|
|
227 | assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read' | |
233 |
|
|
228 | assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read' | |
234 | 'vcs_test_svn': 'repository.read', |
|
|||
235 | } |
|
|||
236 |
|
229 | |||
237 | def test_propagated_permission_from_users_group_by_explicit_perms_exist( |
|
230 | def test_propagated_permission_from_users_group_by_explicit_perms_exist( | |
238 | self, repo_name): |
|
231 | self, repo_name): | |
@@ -301,10 +294,10 b' class TestPermissions(object):' | |||||
301 | self.g2 = fixture.create_repo_group('group2', skip_if_exists=True) |
|
294 | self.g2 = fixture.create_repo_group('group2', skip_if_exists=True) | |
302 | # both perms should be read ! |
|
295 | # both perms should be read ! | |
303 | assert group_perms(self.u1) == \ |
|
296 | assert group_perms(self.u1) == \ | |
304 |
{ |
|
297 | {'group1': 'group.read', 'group2': 'group.read'} | |
305 |
|
298 | |||
306 | assert group_perms(self.anon) == \ |
|
299 | assert group_perms(self.anon) == \ | |
307 |
{ |
|
300 | {'group1': 'group.read', 'group2': 'group.read'} | |
308 |
|
301 | |||
309 | # Change perms to none for both groups |
|
302 | # Change perms to none for both groups | |
310 | RepoGroupModel().grant_user_permission( |
|
303 | RepoGroupModel().grant_user_permission( | |
@@ -313,9 +306,9 b' class TestPermissions(object):' | |||||
313 | repo_group=self.g2, user=self.anon, perm='group.none') |
|
306 | repo_group=self.g2, user=self.anon, perm='group.none') | |
314 |
|
307 | |||
315 | assert group_perms(self.u1) == \ |
|
308 | assert group_perms(self.u1) == \ | |
316 |
{ |
|
309 | {'group1': 'group.none', 'group2': 'group.none'} | |
317 | assert group_perms(self.anon) == \ |
|
310 | assert group_perms(self.anon) == \ | |
318 |
{ |
|
311 | {'group1': 'group.none', 'group2': 'group.none'} | |
319 |
|
312 | |||
320 | # add repo to group |
|
313 | # add repo to group | |
321 | name = RepoGroup.url_sep().join([self.g1.group_name, 'test_perm']) |
|
314 | name = RepoGroup.url_sep().join([self.g1.group_name, 'test_perm']) | |
@@ -325,9 +318,9 b' class TestPermissions(object):' | |||||
325 | cur_user=self.u1,) |
|
318 | cur_user=self.u1,) | |
326 |
|
319 | |||
327 | assert group_perms(self.u1) == \ |
|
320 | assert group_perms(self.u1) == \ | |
328 |
{ |
|
321 | {'group1': 'group.none', 'group2': 'group.none'} | |
329 | assert group_perms(self.anon) == \ |
|
322 | assert group_perms(self.anon) == \ | |
330 |
{ |
|
323 | {'group1': 'group.none', 'group2': 'group.none'} | |
331 |
|
324 | |||
332 | # grant permission for u2 ! |
|
325 | # grant permission for u2 ! | |
333 | RepoGroupModel().grant_user_permission( |
|
326 | RepoGroupModel().grant_user_permission( | |
@@ -339,16 +332,16 b' class TestPermissions(object):' | |||||
339 |
|
332 | |||
340 | # u1 and anon should have not change perms while u2 should ! |
|
333 | # u1 and anon should have not change perms while u2 should ! | |
341 | assert group_perms(self.u1) == \ |
|
334 | assert group_perms(self.u1) == \ | |
342 |
{ |
|
335 | {'group1': 'group.none', 'group2': 'group.none'} | |
343 | assert group_perms(self.u2) == \ |
|
336 | assert group_perms(self.u2) == \ | |
344 |
{ |
|
337 | {'group1': 'group.read', 'group2': 'group.read'} | |
345 | assert group_perms(self.anon) == \ |
|
338 | assert group_perms(self.anon) == \ | |
346 |
{ |
|
339 | {'group1': 'group.none', 'group2': 'group.none'} | |
347 |
|
340 | |||
348 | def test_repo_group_user_as_user_group_member(self): |
|
341 | def test_repo_group_user_as_user_group_member(self): | |
349 | # create Group1 |
|
342 | # create Group1 | |
350 | self.g1 = fixture.create_repo_group('group1', skip_if_exists=True) |
|
343 | self.g1 = fixture.create_repo_group('group1', skip_if_exists=True) | |
351 |
assert group_perms(self.anon) == { |
|
344 | assert group_perms(self.anon) == {'group1': 'group.read'} | |
352 |
|
345 | |||
353 | # set default permission to none |
|
346 | # set default permission to none | |
354 | RepoGroupModel().grant_user_permission( |
|
347 | RepoGroupModel().grant_user_permission( | |
@@ -368,8 +361,8 b' class TestPermissions(object):' | |||||
368 | # add some user to that group |
|
361 | # add some user to that group | |
369 |
|
362 | |||
370 | # check his permissions |
|
363 | # check his permissions | |
371 |
assert group_perms(self.anon) == { |
|
364 | assert group_perms(self.anon) == {'group1': 'group.none'} | |
372 |
assert group_perms(self.u1) == { |
|
365 | assert group_perms(self.u1) == {'group1': 'group.none'} | |
373 |
|
366 | |||
374 | # grant ug1 read permissions for |
|
367 | # grant ug1 read permissions for | |
375 | RepoGroupModel().grant_user_group_permission( |
|
368 | RepoGroupModel().grant_user_group_permission( | |
@@ -383,8 +376,8 b' class TestPermissions(object):' | |||||
383 | .scalar() |
|
376 | .scalar() | |
384 | assert obj.permission.permission_name == 'group.read' |
|
377 | assert obj.permission.permission_name == 'group.read' | |
385 |
|
378 | |||
386 |
assert group_perms(self.anon) == { |
|
379 | assert group_perms(self.anon) == {'group1': 'group.none'} | |
387 |
assert group_perms(self.u1) == { |
|
380 | assert group_perms(self.u1) == {'group1': 'group.read'} | |
388 |
|
381 | |||
389 | def test_inherited_permissions_from_default_on_user_enabled(self): |
|
382 | def test_inherited_permissions_from_default_on_user_enabled(self): | |
390 | # enable fork and create on default user |
|
383 | # enable fork and create on default user | |
@@ -598,7 +591,7 b' class TestPermissions(object):' | |||||
598 |
|
591 | |||
599 | # Make him owner of the repo group |
|
592 | # Make him owner of the repo group | |
600 | self.g1.user = self.u1 |
|
593 | self.g1.user = self.u1 | |
601 |
assert group_perms(self.u1) == { |
|
594 | assert group_perms(self.u1) == {'test1': 'group.admin'} | |
602 |
|
595 | |||
603 | def assert_user_perm_equal( |
|
596 | def assert_user_perm_equal( | |
604 | self, user, change_factor=0, compare_keys=None): |
|
597 | self, user, change_factor=0, compare_keys=None): |
@@ -229,7 +229,7 b' license_token = abra-cada-bra1-rce3' | |||||
229 | license.hide_license_info = false |
|
229 | license.hide_license_info = false | |
230 |
|
230 | |||
231 | ; Import EE license from this license path |
|
231 | ; Import EE license from this license path | |
232 |
|
|
232 | license.import_path = %(here)s/rhodecode_enterprise.license | |
233 |
|
233 | |||
234 | ; import license 'if-missing' or 'force' (always override) |
|
234 | ; import license 'if-missing' or 'force' (always override) | |
235 | ; if-missing means apply license if it doesn't exist. 'force' option always overrides it |
|
235 | ; if-missing means apply license if it doesn't exist. 'force' option always overrides it | |
@@ -645,7 +645,7 b' vcs.scm_app_implementation = http' | |||||
645 | ; `http` - use http-rpc backend (default) |
|
645 | ; `http` - use http-rpc backend (default) | |
646 | ; `celery` - use celery based hooks |
|
646 | ; `celery` - use celery based hooks | |
647 | #DEPRECATED:vcs.hooks.protocol = http |
|
647 | #DEPRECATED:vcs.hooks.protocol = http | |
648 |
vcs.hooks.protocol = |
|
648 | vcs.hooks.protocol.v2 = celery | |
649 |
|
649 | |||
650 | ; Host on which this instance is listening for hooks. vcsserver will call this host to pull/push hooks so it should be |
|
650 | ; Host on which this instance is listening for hooks. vcsserver will call this host to pull/push hooks so it should be | |
651 | ; accessible via network. |
|
651 | ; accessible via network. |
General Comments 0
You need to be logged in to leave comments.
Login now