Show More
@@ -99,7 +99,7 b' class RepoGroupsController(BaseControlle' | |||
|
99 | 99 | if repo_group.user: |
|
100 | 100 | data.update({'user': repo_group.user.username}) |
|
101 | 101 | else: |
|
102 | replacement_user = User.get_first_admin().username | |
|
102 | replacement_user = User.get_first_super_admin().username | |
|
103 | 103 | data.update({'user': replacement_user}) |
|
104 | 104 | |
|
105 | 105 | # fill repository group users |
@@ -88,7 +88,7 b' class UserGroupsController(BaseControlle' | |||
|
88 | 88 | if user_group.user: |
|
89 | 89 | data.update({'user': user_group.user.username}) |
|
90 | 90 | else: |
|
91 | replacement_user = User.get_first_admin().username | |
|
91 | replacement_user = User.get_first_super_admin().username | |
|
92 | 92 | data.update({'user': replacement_user}) |
|
93 | 93 | return data |
|
94 | 94 |
@@ -403,7 +403,7 b' class UsersController(BaseController):' | |||
|
403 | 403 | c.active = 'advanced' |
|
404 | 404 | c.perm_user = AuthUser(user_id=user_id, ip_addr=self.ip_addr) |
|
405 | 405 | c.personal_repo_group = RepoGroup.get_by_group_name(user.username) |
|
406 | c.first_admin = User.get_first_admin() | |
|
406 | c.first_admin = User.get_first_super_admin() | |
|
407 | 407 | defaults = user.get_dict() |
|
408 | 408 | |
|
409 | 409 | # Interim workaround if the user participated on any pull requests as a |
@@ -492,7 +492,7 b' def map_groups(path):' | |||
|
492 | 492 | # last element is repo in nested groups structure |
|
493 | 493 | groups = groups[:-1] |
|
494 | 494 | rgm = RepoGroupModel(sa) |
|
495 | owner = User.get_first_admin() | |
|
495 | owner = User.get_first_super_admin() | |
|
496 | 496 | for lvl, group_name in enumerate(groups): |
|
497 | 497 | group_name = '/'.join(groups[:lvl] + [group_name]) |
|
498 | 498 | group = RepoGroup.get_by_group_name(group_name) |
@@ -533,7 +533,7 b' def repo2db_mapper(initial_repo_list, re' | |||
|
533 | 533 | |
|
534 | 534 | sa = meta.Session() |
|
535 | 535 | repo_model = RepoModel() |
|
536 | user = User.get_first_admin() | |
|
536 | user = User.get_first_super_admin() | |
|
537 | 537 | added = [] |
|
538 | 538 | |
|
539 | 539 | # creation defaults |
@@ -776,8 +776,8 b' class User(Base, BaseModel):' | |||
|
776 | 776 | Session().add(self) |
|
777 | 777 | |
|
778 | 778 | @classmethod |
|
779 | def get_first_admin(cls): | |
|
780 |
user = User.query().filter(User.admin == |
|
|
779 | def get_first_super_admin(cls): | |
|
780 | user = User.query().filter(User.admin == true()).first() | |
|
781 | 781 | if user is None: |
|
782 | 782 | raise Exception('Missing administrative account!') |
|
783 | 783 | return user |
@@ -339,7 +339,7 b' class RepoModel(BaseModel):' | |||
|
339 | 339 | if repo_info.user: |
|
340 | 340 | defaults.update({'user': repo_info.user.username}) |
|
341 | 341 | else: |
|
342 | replacement_user = User.get_first_admin().username | |
|
342 | replacement_user = User.get_first_super_admin().username | |
|
343 | 343 | defaults.update({'user': replacement_user}) |
|
344 | 344 | |
|
345 | 345 | # fill repository users |
@@ -377,7 +377,7 b' class UserModel(BaseModel):' | |||
|
377 | 377 | raise |
|
378 | 378 | |
|
379 | 379 | def _handle_user_repos(self, username, repositories, handle_mode=None): |
|
380 | _superadmin = self.cls.get_first_admin() | |
|
380 | _superadmin = self.cls.get_first_super_admin() | |
|
381 | 381 | left_overs = True |
|
382 | 382 | |
|
383 | 383 | from rhodecode.model.repo import RepoModel |
@@ -400,7 +400,7 b' class UserModel(BaseModel):' | |||
|
400 | 400 | |
|
401 | 401 | def _handle_user_repo_groups(self, username, repository_groups, |
|
402 | 402 | handle_mode=None): |
|
403 | _superadmin = self.cls.get_first_admin() | |
|
403 | _superadmin = self.cls.get_first_super_admin() | |
|
404 | 404 | left_overs = True |
|
405 | 405 | |
|
406 | 406 | from rhodecode.model.repo_group import RepoGroupModel |
@@ -422,7 +422,7 b' class UserModel(BaseModel):' | |||
|
422 | 422 | return left_overs |
|
423 | 423 | |
|
424 | 424 | def _handle_user_user_groups(self, username, user_groups, handle_mode=None): |
|
425 | _superadmin = self.cls.get_first_admin() | |
|
425 | _superadmin = self.cls.get_first_super_admin() | |
|
426 | 426 | left_overs = True |
|
427 | 427 | |
|
428 | 428 | from rhodecode.model.user_group import UserGroupModel |
@@ -498,7 +498,7 b' class UserGroupModel(BaseModel):' | |||
|
498 | 498 | self.remove_user_from_group(gr, user) |
|
499 | 499 | |
|
500 | 500 | # now we calculate in which groups user should be == groups params |
|
501 | owner = User.get_first_admin().username | |
|
501 | owner = User.get_first_super_admin().username | |
|
502 | 502 | for gr in set(groups): |
|
503 | 503 | existing_group = UserGroup.get_by_group_name(gr) |
|
504 | 504 | if not existing_group: |
@@ -33,7 +33,7 b' class TestFeedController(TestController)' | |||
|
33 | 33 | assert """<rss version="2.0">""" in response |
|
34 | 34 | |
|
35 | 35 | def test_rss_with_auth_token(self, backend): |
|
36 | auth_token = User.get_first_admin().feed_token | |
|
36 | auth_token = User.get_first_super_admin().feed_token | |
|
37 | 37 | assert auth_token != '' |
|
38 | 38 | response = self.app.get(url(controller='feed', action='rss', |
|
39 | 39 | repo_name=backend.repo_name, auth_token=auth_token)) |
@@ -448,7 +448,7 b' class TestLoginController:' | |||
|
448 | 448 | assert [] == whitelist['api_access_controllers_whitelist'] |
|
449 | 449 | if test_name == 'proper_auth_token': |
|
450 | 450 | # use builtin if api_key is None |
|
451 | auth_token = User.get_first_admin().api_key | |
|
451 | auth_token = User.get_first_super_admin().api_key | |
|
452 | 452 | |
|
453 | 453 | with fixture.anon_access(False): |
|
454 | 454 | self.app.get(url(controller='changeset', |
@@ -471,7 +471,7 b' class TestLoginController:' | |||
|
471 | 471 | assert ['ChangesetController:changeset_raw'] == \ |
|
472 | 472 | whitelist['api_access_controllers_whitelist'] |
|
473 | 473 | if test_name == 'proper_auth_token': |
|
474 | auth_token = User.get_first_admin().api_key | |
|
474 | auth_token = User.get_first_super_admin().api_key | |
|
475 | 475 | |
|
476 | 476 | with fixture.anon_access(False): |
|
477 | 477 | self.app.get(url(controller='changeset', |
General Comments 0
You need to be logged in to leave comments.
Login now