Show More
@@ -617,11 +617,11 b' class PermissionCalculator(object):' | |||
|
617 | 617 | multiple_counter = collections.defaultdict(int) |
|
618 | 618 | for perm in user_repo_perms_from_user_group: |
|
619 | 619 | r_k = perm.UserGroupRepoToPerm.repository.repo_name |
|
620 | ug_k = perm.UserGroupRepoToPerm.users_group.users_group_name | |
|
621 | 620 | multiple_counter[r_k] += 1 |
|
621 | p = perm.Permission.permission_name | |
|
622 | o = PermOrigin.REPO_USERGROUP % perm.UserGroupRepoToPerm\ | |
|
623 | .users_group.users_group_name | |
|
622 | 624 | |
|
623 | p = perm.Permission.permission_name | |
|
624 | o = PermOrigin.REPO_USERGROUP % ug_k | |
|
625 | 625 | if multiple_counter[r_k] > 1: |
|
626 | 626 | cur_perm = self.permissions_repositories[r_k] |
|
627 | 627 | p = self._choose_permission(p, cur_perm) |
@@ -671,30 +671,30 b' class PermissionCalculator(object):' | |||
|
671 | 671 | |
|
672 | 672 | multiple_counter = collections.defaultdict(int) |
|
673 | 673 | for perm in user_repo_group_perms_from_user_group: |
|
674 | g_k = perm.UserGroupRepoGroupToPerm.group.group_name | |
|
675 | ug_k = perm.UserGroupRepoGroupToPerm.users_group.users_group_name | |
|
676 | multiple_counter[g_k] += 1 | |
|
677 | o = PermOrigin.REPOGROUP_USERGROUP % ug_k | |
|
674 | rg_k = perm.UserGroupRepoGroupToPerm.group.group_name | |
|
675 | multiple_counter[rg_k] += 1 | |
|
676 | o = PermOrigin.REPOGROUP_USERGROUP % perm.UserGroupRepoGroupToPerm\ | |
|
677 | .users_group.users_group_name | |
|
678 | 678 | p = perm.Permission.permission_name |
|
679 | 679 | |
|
680 | if multiple_counter[g_k] > 1: | |
|
681 | cur_perm = self.permissions_repository_groups[g_k] | |
|
680 | if multiple_counter[rg_k] > 1: | |
|
681 | cur_perm = self.permissions_repository_groups[rg_k] | |
|
682 | 682 | p = self._choose_permission(p, cur_perm) |
|
683 | self.permissions_repository_groups[g_k] = p, o | |
|
683 | self.permissions_repository_groups[rg_k] = p, o | |
|
684 | 684 | |
|
685 | 685 | if perm.RepoGroup.user_id == self.user_id: |
|
686 | 686 | # set admin if owner, even for member of other user group |
|
687 | 687 | p = 'group.admin' |
|
688 | 688 | o = PermOrigin.REPOGROUP_OWNER |
|
689 | self.permissions_repository_groups[g_k] = p, o | |
|
689 | self.permissions_repository_groups[rg_k] = p, o | |
|
690 | 690 | |
|
691 | 691 | # user explicit permissions for repository groups |
|
692 | 692 | user_repo_groups_perms = Permission.get_default_group_perms( |
|
693 | 693 | self.user_id, self.scope_repo_group_id) |
|
694 | 694 | for perm in user_repo_groups_perms: |
|
695 | 695 | rg_k = perm.UserRepoGroupToPerm.group.group_name |
|
696 |
|
|
|
697 | o = PermOrigin.REPOGROUP_USER % u_k | |
|
696 | o = PermOrigin.REPOGROUP_USER % perm.UserRepoGroupToPerm\ | |
|
697 | .user.username | |
|
698 | 698 | p = perm.Permission.permission_name |
|
699 | 699 | |
|
700 | 700 | if not self.explicit: |
@@ -721,33 +721,32 b' class PermissionCalculator(object):' | |||
|
721 | 721 | |
|
722 | 722 | multiple_counter = collections.defaultdict(int) |
|
723 | 723 | for perm in user_group_from_user_group: |
|
724 | g_k = perm.UserGroupUserGroupToPerm\ | |
|
724 | ug_k = perm.UserGroupUserGroupToPerm\ | |
|
725 | 725 | .target_user_group.users_group_name |
|
726 | u_k = perm.UserGroupUserGroupToPerm\ | |
|
726 | multiple_counter[ug_k] += 1 | |
|
727 | o = PermOrigin.USERGROUP_USERGROUP % perm.UserGroupUserGroupToPerm\ | |
|
727 | 728 | .user_group.users_group_name |
|
728 | multiple_counter[g_k] += 1 | |
|
729 | o = PermOrigin.USERGROUP_USERGROUP % u_k | |
|
730 | 729 | p = perm.Permission.permission_name |
|
731 | 730 | |
|
732 | if multiple_counter[g_k] > 1: | |
|
733 | cur_perm = self.permissions_user_groups[g_k] | |
|
731 | if multiple_counter[ug_k] > 1: | |
|
732 | cur_perm = self.permissions_user_groups[ug_k] | |
|
734 | 733 | p = self._choose_permission(p, cur_perm) |
|
735 | 734 | |
|
736 | self.permissions_user_groups[g_k] = p, o | |
|
735 | self.permissions_user_groups[ug_k] = p, o | |
|
737 | 736 | |
|
738 | 737 | if perm.UserGroup.user_id == self.user_id: |
|
739 | 738 | # set admin if owner, even for member of other user group |
|
740 | 739 | p = 'usergroup.admin' |
|
741 | 740 | o = PermOrigin.USERGROUP_OWNER |
|
742 | self.permissions_user_groups[g_k] = p, o | |
|
741 | self.permissions_user_groups[ug_k] = p, o | |
|
743 | 742 | |
|
744 | 743 | # user explicit permission for user groups |
|
745 | 744 | user_user_groups_perms = Permission.get_default_user_group_perms( |
|
746 | 745 | self.user_id, self.scope_user_group_id) |
|
747 | 746 | for perm in user_user_groups_perms: |
|
748 | 747 | ug_k = perm.UserUserGroupToPerm.user_group.users_group_name |
|
749 |
|
|
|
750 | o = PermOrigin.USERGROUP_USER % u_k | |
|
748 | o = PermOrigin.USERGROUP_USER % perm.UserUserGroupToPerm\ | |
|
749 | .user.username | |
|
751 | 750 | p = perm.Permission.permission_name |
|
752 | 751 | |
|
753 | 752 | if not self.explicit: |
General Comments 0
You need to be logged in to leave comments.
Login now