Skip to content

Commit

Permalink
change the REPOSITORY_BLOCK_USER_LOGS values from users to repository…
Browse files Browse the repository at this point in the history
… authorizations
  • Loading branch information
helllllllder committed Apr 28, 2022
1 parent ee0de44 commit c88b7f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 4 additions & 6 deletions bothub/api/v2/nlp/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ class Meta:
)

def create(self, validated_data):
user = validated_data.get("user").user
if (
user.is_organization is False
and user.user.email in settings.REPOSITORY_BLOCK_USER_LOGS
):
return validated_data # ToDo: Return a message
repository_auth = validated_data.get("user")
user = repository_auth.user
if repository_auth.pk in settings.REPOSITORY_BLOCK_USER_LOGS:
return validated_data
log_intent = validated_data.pop("log_intent")
validated_data.update({"user": user})

Expand Down
2 changes: 1 addition & 1 deletion bothub/api/v2/tests/test_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def list_request(self, data, token=None):
return (response, content_data)

def test_blocked_user(self):
with self.settings(REPOSITORY_BLOCK_USER_LOGS=[self.owner.email]):
with self.settings(REPOSITORY_BLOCK_USER_LOGS=[self.repository_auth.pk]):
data = {
"text": "test",
"user_agent": "python-requests/2.20.1",
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version: '3.6'

services:
database:
image: postgres:11.1
image: postgres
ports:
- 5432:5432
volumes:
Expand Down Expand Up @@ -161,6 +161,9 @@ services:
- default
- bothub

volumes:
postgres:

networks:
bothub:
external: true

0 comments on commit c88b7f7

Please sign in to comment.