diff --git a/bothub/api/v2/repository/serializers.py b/bothub/api/v2/repository/serializers.py index 6e8a40bc..de68ca20 100644 --- a/bothub/api/v2/repository/serializers.py +++ b/bothub/api/v2/repository/serializers.py @@ -553,7 +553,7 @@ class RepositoryUpload(serializers.Serializer): class RepositoryGroupPermissionsSerializer(serializers.ModelSerializer): class Meta: model = UserGroupRepository - fields = ["uuid", "name", "permission"] + fields = ["uuid", "repository", "name", "permission"] ref_name = None permission = serializers.SerializerMethodField() diff --git a/bothub/common/models.py b/bothub/common/models.py index b251db22..aaae2a12 100644 --- a/bothub/common/models.py +++ b/bothub/common/models.py @@ -1067,25 +1067,6 @@ def check_permission(self, code_permission): codename=PermissionsCode.objects.filter(codename=code_permission).first() ).exists() - # - # @property - # def can_contribute(self): - # return True - # # return self.level in [ - # # RepositoryAuthorization.LEVEL_CONTRIBUTOR, - # # RepositoryAuthorization.LEVEL_ADMIN, - # # ] - # - # @property - # def can_write(self): - # return True - # # return self.level in [RepositoryAuthorization.LEVEL_ADMIN] - # - # @property - # def is_admin(self): - # return True - # # return self.level == RepositoryAuthorization.LEVEL_ADMIN - @property def is_owner(self): try: diff --git a/bothub/common/tests.py b/bothub/common/tests.py index c1430855..d86f0756 100644 --- a/bothub/common/tests.py +++ b/bothub/common/tests.py @@ -328,15 +328,15 @@ def test_can_read(self): self.owner, return_group="Owner" ) self.assertTrue(authorization_owner.check_permission("view.repository")) - # # secondary user in public repository + # secondary user in public repository authorization_user = self.repository.get_user_authorization(self.user) self.assertTrue(authorization_user.check_permission("view.repository")) - # # private repository owner + # private repository owner private_authorization_owner = self.private_repository.get_user_authorization( self.owner, return_group="Owner" ) self.assertTrue(private_authorization_owner.check_permission("view.repository")) - # # secondary user in private repository + # secondary user in private repository private_authorization_user = self.private_repository.get_user_authorization( self.user )