maquinaweb-shared-auth 0.2.25__py3-none-any.whl → 0.2.27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of maquinaweb-shared-auth might be problematic. Click here for more details.
- maquinaweb_shared_auth-0.2.27.dist-info/METADATA +1002 -0
- {maquinaweb_shared_auth-0.2.25.dist-info → maquinaweb_shared_auth-0.2.27.dist-info}/RECORD +6 -6
- shared_auth/models.py +11 -9
- shared_auth/serializers.py +3 -1
- maquinaweb_shared_auth-0.2.25.dist-info/METADATA +0 -1017
- {maquinaweb_shared_auth-0.2.25.dist-info → maquinaweb_shared_auth-0.2.27.dist-info}/WHEEL +0 -0
- {maquinaweb_shared_auth-0.2.25.dist-info → maquinaweb_shared_auth-0.2.27.dist-info}/top_level.txt +0 -0
|
@@ -8,14 +8,14 @@ shared_auth/fields.py,sha256=RAcmFh1D_nkbai_7t_OrPZhfhAipesy5kKnEj4LUvvM,1254
|
|
|
8
8
|
shared_auth/managers.py,sha256=xRj8d5r2Q5pBi36dQAOasS7EPvUUehb0eFbA-sAuzxY,6727
|
|
9
9
|
shared_auth/middleware.py,sha256=72GF8kGijbhw98v2Q-1sXBXk-7Bamfyvypm9h8xLX_I,6112
|
|
10
10
|
shared_auth/mixins.py,sha256=BSYNTWYjLRGuxfy7x-uAaNZmrTMsm67ogAQzjrU2DoQ,7388
|
|
11
|
-
shared_auth/models.py,sha256=
|
|
11
|
+
shared_auth/models.py,sha256=vCyssDwKfWRE3ofl6LK_CB1-y5O-_6uvJyGZGoCnb44,6574
|
|
12
12
|
shared_auth/permissions.py,sha256=FNIp12ePOUlXVp26zNMAyEtzX9kwyP7RuNIgaaCXtPA,2671
|
|
13
13
|
shared_auth/router.py,sha256=zYidJ7j40lQLrhkCtAQAp-rQLhua_UF0X7SDzYRcV5w,668
|
|
14
|
-
shared_auth/serializers.py,sha256=
|
|
14
|
+
shared_auth/serializers.py,sha256=h50UhgOJ6Z6HNtxWjv6OK-Z9F_DOuV-PcCAg6FCzBtU,5125
|
|
15
15
|
shared_auth/storage_backend.py,sha256=Eqkjz8aF5UrOpRwYl-J0Td95IObfxnJ8eLQDJVFM3Io,184
|
|
16
16
|
shared_auth/urls.py,sha256=591wWEWJPaHEGkcOZ8yvfgxddRyOcZLgOc0vNtF7XRI,289
|
|
17
17
|
shared_auth/views.py,sha256=2hyLnYSWUscfq-jVcskt-ukzDt4vg6IXeKjRDRu9RXk,1519
|
|
18
|
-
maquinaweb_shared_auth-0.2.
|
|
19
|
-
maquinaweb_shared_auth-0.2.
|
|
20
|
-
maquinaweb_shared_auth-0.2.
|
|
21
|
-
maquinaweb_shared_auth-0.2.
|
|
18
|
+
maquinaweb_shared_auth-0.2.27.dist-info/METADATA,sha256=5xy3iG2RNHGZFu4eC_86xna6tzPpXfefwQLRk0inRJw,26331
|
|
19
|
+
maquinaweb_shared_auth-0.2.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
20
|
+
maquinaweb_shared_auth-0.2.27.dist-info/top_level.txt,sha256=msyYRy02ZV7zz7GR1raUI5LXGFIFn2TIkgkeKZqKufE,12
|
|
21
|
+
maquinaweb_shared_auth-0.2.27.dist-info/RECORD,,
|
shared_auth/models.py
CHANGED
|
@@ -3,16 +3,15 @@ Models READ-ONLY para acesso aos dados de autenticação
|
|
|
3
3
|
ATENÇÃO: Estes models NÃO devem ser usados para criar migrations
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
+
import os
|
|
7
|
+
|
|
6
8
|
from django.contrib.auth.models import AbstractUser
|
|
7
9
|
from django.db import models
|
|
10
|
+
|
|
11
|
+
from .conf import MEMBER_TABLE, ORGANIZATION_TABLE, TOKEN_TABLE, USER_TABLE
|
|
8
12
|
from .exceptions import OrganizationNotFoundError
|
|
9
|
-
from .
|
|
13
|
+
from .managers import SharedMemberManager, SharedOrganizationManager, SharedUserManager
|
|
10
14
|
from .storage_backend import Storage
|
|
11
|
-
from .managers import (
|
|
12
|
-
SharedMemberManager,
|
|
13
|
-
SharedOrganizationManager,
|
|
14
|
-
SharedUserManager,
|
|
15
|
-
)
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
class SharedToken(models.Model):
|
|
@@ -46,6 +45,7 @@ class SharedToken(models.Model):
|
|
|
46
45
|
# Implementar lógica de expiração se necessário
|
|
47
46
|
return True
|
|
48
47
|
|
|
48
|
+
|
|
49
49
|
def organization_image_path(instance, filename):
|
|
50
50
|
return os.path.join(
|
|
51
51
|
"organization",
|
|
@@ -54,6 +54,7 @@ def organization_image_path(instance, filename):
|
|
|
54
54
|
filename,
|
|
55
55
|
)
|
|
56
56
|
|
|
57
|
+
|
|
57
58
|
class SharedOrganization(models.Model):
|
|
58
59
|
"""
|
|
59
60
|
Model READ-ONLY da tabela organization
|
|
@@ -67,7 +68,9 @@ class SharedOrganization(models.Model):
|
|
|
67
68
|
telephone = models.CharField(max_length=50, blank=True, null=True)
|
|
68
69
|
cellphone = models.CharField(max_length=50, blank=True, null=True)
|
|
69
70
|
email = models.EmailField(blank=True, null=True)
|
|
70
|
-
image_organization = models.ImageField(
|
|
71
|
+
image_organization = models.ImageField(
|
|
72
|
+
storage=Storage, upload_to=organization_image_path, null=True
|
|
73
|
+
)
|
|
71
74
|
|
|
72
75
|
# Relacionamentos
|
|
73
76
|
main_organization_id = models.IntegerField(null=True, blank=True)
|
|
@@ -146,7 +149,7 @@ class User(AbstractUser):
|
|
|
146
149
|
|
|
147
150
|
date_joined = models.DateTimeField()
|
|
148
151
|
last_login = models.DateTimeField(null=True, blank=True)
|
|
149
|
-
avatar = models.ImageField(storage=Storage,blank=True, null=True)
|
|
152
|
+
avatar = models.ImageField(storage=Storage, blank=True, null=True)
|
|
150
153
|
# Campos customizados
|
|
151
154
|
createdat = models.DateTimeField()
|
|
152
155
|
updatedat = models.DateTimeField()
|
|
@@ -188,7 +191,6 @@ class User(AbstractUser):
|
|
|
188
191
|
return organization
|
|
189
192
|
|
|
190
193
|
|
|
191
|
-
|
|
192
194
|
class SharedMember(models.Model):
|
|
193
195
|
"""
|
|
194
196
|
Model READ-ONLY da tabela organization_member
|
shared_auth/serializers.py
CHANGED
|
@@ -38,6 +38,7 @@ class OrganizationSerializerMixin(serializers.ModelSerializer):
|
|
|
38
38
|
"id": org.pk,
|
|
39
39
|
"name": org.name,
|
|
40
40
|
"fantasy_name": org.fantasy_name,
|
|
41
|
+
"image_organization": org.image_organization.url if org.image_organization else None,
|
|
41
42
|
"cnpj": org.cnpj,
|
|
42
43
|
"email": org.email,
|
|
43
44
|
"telephone": org.telephone,
|
|
@@ -99,11 +100,12 @@ class UserSerializerMixin(serializers.ModelSerializer):
|
|
|
99
100
|
def get_user(self, obj):
|
|
100
101
|
"""Retorna dados do usuário como objeto"""
|
|
101
102
|
try:
|
|
102
|
-
user = obj.user
|
|
103
|
+
user: User = obj.user
|
|
103
104
|
return {
|
|
104
105
|
"id": user.pk,
|
|
105
106
|
"username": user.username,
|
|
106
107
|
"email": user.email,
|
|
108
|
+
"avatar": user.avatar.url if user.avatar else None,
|
|
107
109
|
"first_name": user.first_name,
|
|
108
110
|
"last_name": user.last_name,
|
|
109
111
|
"full_name": user.get_full_name(),
|