maquinaweb-shared-auth 0.2.22__py3-none-any.whl → 0.2.24__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maquinaweb-shared-auth
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: Models read-only para autenticação compartilhada entre projetos Django.
5
5
  Author-email: Seu Nome <seuemail@dominio.com>
6
6
  License: MIT
@@ -15,6 +15,7 @@ Classifier: Operating System :: OS Independent
15
15
  Requires-Python: >=3.8
16
16
  Description-Content-Type: text/markdown
17
17
  Requires-Dist: django>=5
18
+ Requires-Dist: django-storages>=1.14.6
18
19
  Requires-Dist: djangorestframework>=3
19
20
  Requires-Dist: setuptools>=70
20
21
  Dynamic: requires-python
@@ -8,13 +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=n6-m8DD8PA7HlDE9crSzpeiZjaOng1Yw6eyV3sfFct0,6185
11
+ shared_auth/models.py,sha256=5AmjW-NJnqYn3MawGYY3VFo1Eow3BXgJbUCHQtdqslA,6562
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=uhSrcmFgBUnIWUiKymQrsSNpFDTj3j1Eged2lPG2M0s,4588
14
+ shared_auth/serializers.py,sha256=zTsmx534Z4Ms1-ZRsFeu4QK0ksHZgpyOz9GMXAlaF34,4949
15
+ shared_auth/storage_backend.py,sha256=-2UqRyXT2WaGXFviRgZRrq0iWRLwci5HmZkY6tAZZoY,132
15
16
  shared_auth/urls.py,sha256=591wWEWJPaHEGkcOZ8yvfgxddRyOcZLgOc0vNtF7XRI,289
16
17
  shared_auth/views.py,sha256=2hyLnYSWUscfq-jVcskt-ukzDt4vg6IXeKjRDRu9RXk,1519
17
- maquinaweb_shared_auth-0.2.22.dist-info/METADATA,sha256=b8T2QHGmwsdvnIpSrDfptw3cbPmUCZ57ra3Vl8RJKc0,27151
18
- maquinaweb_shared_auth-0.2.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- maquinaweb_shared_auth-0.2.22.dist-info/top_level.txt,sha256=msyYRy02ZV7zz7GR1raUI5LXGFIFn2TIkgkeKZqKufE,12
20
- maquinaweb_shared_auth-0.2.22.dist-info/RECORD,,
18
+ maquinaweb_shared_auth-0.2.24.dist-info/METADATA,sha256=BuMhI_eW59_M8llwLEK-_AMJfEUINtQ-NaXjqya7jiI,27190
19
+ maquinaweb_shared_auth-0.2.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ maquinaweb_shared_auth-0.2.24.dist-info/top_level.txt,sha256=msyYRy02ZV7zz7GR1raUI5LXGFIFn2TIkgkeKZqKufE,12
21
+ maquinaweb_shared_auth-0.2.24.dist-info/RECORD,,
shared_auth/models.py CHANGED
@@ -7,6 +7,7 @@ from django.contrib.auth.models import AbstractUser
7
7
  from django.db import models
8
8
  from .exceptions import OrganizationNotFoundError
9
9
  from .conf import MEMBER_TABLE, ORGANIZATION_TABLE, USER_TABLE, TOKEN_TABLE
10
+ from .storage_backend import Storage
10
11
  from .managers import (
11
12
  SharedMemberManager,
12
13
  SharedOrganizationManager,
@@ -45,6 +46,13 @@ class SharedToken(models.Model):
45
46
  # Implementar lógica de expiração se necessário
46
47
  return True
47
48
 
49
+ def organization_image_path(instance, filename):
50
+ return os.path.join(
51
+ "organization",
52
+ str(instance.pk),
53
+ "images",
54
+ filename,
55
+ )
48
56
 
49
57
  class SharedOrganization(models.Model):
50
58
  """
@@ -59,6 +67,7 @@ class SharedOrganization(models.Model):
59
67
  telephone = models.CharField(max_length=50, blank=True, null=True)
60
68
  cellphone = models.CharField(max_length=50, blank=True, null=True)
61
69
  email = models.EmailField(blank=True, null=True)
70
+ image_organization = models.ImageField(storage=Storage,upload_to=organization_image_path, null=True)
62
71
 
63
72
  # Relacionamentos
64
73
  main_organization_id = models.IntegerField(null=True, blank=True)
@@ -137,7 +146,7 @@ class User(AbstractUser):
137
146
 
138
147
  date_joined = models.DateTimeField()
139
148
  last_login = models.DateTimeField(null=True, blank=True)
140
-
149
+ avatar = models.ImageField(storage=Storage,blank=True, null=True)
141
150
  # Campos customizados
142
151
  createdat = models.DateTimeField()
143
152
  updatedat = models.DateTimeField()
@@ -1,11 +1,10 @@
1
1
  """
2
2
  Serializers compartilhados para DRF
3
3
  """
4
- from rest_framework import serializers
5
4
  from .models import SharedOrganization, User
5
+ from rest_framework import serializers
6
6
 
7
-
8
- class OrganizationSerializerMixin:
7
+ class OrganizationSerializerMixin(serializers.ModelSerializer):
9
8
  """
10
9
  Mixin para serializers que incluem dados de organização como objeto aninhado
11
10
 
@@ -58,9 +57,20 @@ class OrganizationSerializer(serializers.ModelSerializer):
58
57
  class UserSerializer(serializers.ModelSerializer):
59
58
  class Meta:
60
59
  model = User
61
- fields = "__all__"
62
-
63
- class UserSerializerMixin:
60
+ fields = [
61
+ "id",
62
+ "username",
63
+ "first_name",
64
+ "last_name",
65
+ "email",
66
+ "is_active",
67
+ "is_staff",
68
+ "is_superuser",
69
+ "date_joined",
70
+ "last_login",
71
+ ]
72
+
73
+ class UserSerializerMixin(serializers.ModelSerializer):
64
74
  """
65
75
  Mixin para serializers que incluem dados de usuário como objeto aninhado
66
76
 
@@ -134,7 +144,7 @@ class OrganizationUserSerializerMixin(OrganizationSerializerMixin, UserSerialize
134
144
 
135
145
 
136
146
  # Versões simplificadas (opcional)
137
- class OrganizationSimpleSerializerMixin:
147
+ class OrganizationSimpleSerializerMixin(serializers.ModelSerializer):
138
148
  """
139
149
  Versão simplificada que retorna apenas campos essenciais da organização
140
150
  """
@@ -153,7 +163,7 @@ class OrganizationSimpleSerializerMixin:
153
163
  return None
154
164
 
155
165
 
156
- class UserSimpleSerializerMixin:
166
+ class UserSimpleSerializerMixin(serializers.ModelSerializer):
157
167
  """
158
168
  Versão simplificada que retorna apenas campos essenciais do usuário
159
169
  """
@@ -0,0 +1,6 @@
1
+ from storages.backends.s3boto3 import S3Boto3Storage
2
+
3
+
4
+ class Storage(S3Boto3Storage):
5
+ location = "media"
6
+ custom_domain = ""