Skip to content

Commit

Permalink
Merge pull request #668 from Ilhasoft/hotfix/update_repository_get_us…
Browse files Browse the repository at this point in the history
…er_authorization

Hotfix/update repository get user authorization
  • Loading branch information
helllllllder committed Oct 29, 2021
2 parents f2002fd + 34363e4 commit 39dcc5c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ django-elasticsearch-dsl-drf= "~=0.22.1"
elasticsearch= "~=7.14.0"
elasticsearch-dsl= "~=7.4.0"
psycopg2-binary = "~=2.9.1"
weni-protobuffers = "~=1.1.0"
weni-protobuffers = "~=1.2.1"

[dev-packages]
"flake8" = "~=4.0.0"
Expand Down
65 changes: 33 additions & 32 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions bothub/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,12 @@ def get_user_authorization(self, user):
get, created = RepositoryAuthorization.objects.get_or_create(
user=user.repository_owner, repository=self
)
if self.owner.is_organization:
org_role = self.owner.organization.get_organization_authorization(user).role
if get.role != org_role and get.role == 0:
get.role = org_role
get.save()

return get

def get_absolute_url(self):
Expand Down

0 comments on commit 39dcc5c

Please sign in to comment.