maquinaweb-shared-auth 0.2.35__tar.gz → 0.2.37__tar.gz

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.

Files changed (29) hide show
  1. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/PKG-INFO +1 -1
  2. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/maquinaweb_shared_auth.egg-info/PKG-INFO +1 -1
  3. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/pyproject.toml +1 -1
  4. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/serializers.py +2 -2
  5. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/utils.py +32 -16
  6. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/README.md +0 -0
  7. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/maquinaweb_shared_auth.egg-info/SOURCES.txt +0 -0
  8. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/maquinaweb_shared_auth.egg-info/dependency_links.txt +0 -0
  9. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/maquinaweb_shared_auth.egg-info/requires.txt +0 -0
  10. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/maquinaweb_shared_auth.egg-info/top_level.txt +0 -0
  11. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/setup.cfg +0 -0
  12. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/setup.py +0 -0
  13. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/__init__.py +0 -0
  14. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/abstract_models.py +0 -0
  15. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/app.py +0 -0
  16. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/authentication.py +0 -0
  17. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/conf.py +0 -0
  18. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/decorators.py +0 -0
  19. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/exceptions.py +0 -0
  20. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/fields.py +0 -0
  21. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/managers.py +0 -0
  22. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/middleware.py +0 -0
  23. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/mixins.py +0 -0
  24. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/models.py +0 -0
  25. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/permissions.py +0 -0
  26. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/router.py +0 -0
  27. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/storage_backend.py +0 -0
  28. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/urls.py +0 -0
  29. {maquinaweb_shared_auth-0.2.35 → maquinaweb_shared_auth-0.2.37}/shared_auth/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maquinaweb-shared-auth
3
- Version: 0.2.35
3
+ Version: 0.2.37
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maquinaweb-shared-auth
3
- Version: 0.2.35
3
+ Version: 0.2.37
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maquinaweb-shared-auth"
7
- version = "0.2.35"
7
+ version = "0.2.37"
8
8
  description = "Models read-only para autenticação compartilhada entre projetos Django."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.13"
@@ -13,7 +13,7 @@ Se quiser usar separadamente:
13
13
 
14
14
  from rest_framework import serializers
15
15
 
16
- from .utils import get_organization_model, get_user_model
16
+ from .utils import get_organization_model, get_organization_serializer, get_user_model
17
17
 
18
18
 
19
19
  class OrganizationCreateSerializerMixin(serializers.ModelSerializer):
@@ -117,7 +117,7 @@ class OrganizationListCreateSerializerMixin(
117
117
  pass
118
118
 
119
119
 
120
- class OrganizationSerializer(serializers.ModelSerializer):
120
+ class OrganizationSerializer(get_organization_serializer()):
121
121
  """
122
122
  Serializer para o model de Organization configurado.
123
123
  Usa get_organization_model() para suportar models customizados.
@@ -4,7 +4,9 @@ Similar ao get_user_model() do Django
4
4
  """
5
5
 
6
6
  from django.apps import apps
7
+ from django.conf import importlib
7
8
  from django.core.exceptions import ImproperlyConfigured
9
+ from rest_framework import serializers
8
10
 
9
11
  from .conf import get_setting
10
12
 
@@ -12,15 +14,15 @@ from .conf import get_setting
12
14
  def get_token_model():
13
15
  """
14
16
  Retorna o model de Token configurado ou o padrão.
15
-
17
+
16
18
  Usage:
17
19
  from shared_auth.utils import get_token_model
18
-
20
+
19
21
  Token = get_token_model()
20
22
  token = Token.objects.get(key='abc123')
21
23
  """
22
- model_string = get_setting('SHARED_AUTH_TOKEN_MODEL', 'shared_auth.SharedToken')
23
-
24
+ model_string = get_setting("SHARED_AUTH_TOKEN_MODEL", "shared_auth.SharedToken")
25
+
24
26
  try:
25
27
  return apps.get_model(model_string, require_ready=False)
26
28
  except ValueError:
@@ -38,15 +40,17 @@ def get_token_model():
38
40
  def get_organization_model():
39
41
  """
40
42
  Retorna o model de Organization configurado ou o padrão.
41
-
43
+
42
44
  Usage:
43
45
  from shared_auth.utils import get_organization_model
44
-
46
+
45
47
  Organization = get_organization_model()
46
48
  org = Organization.objects.get(id=1)
47
49
  """
48
- model_string = get_setting('SHARED_AUTH_ORGANIZATION_MODEL', 'shared_auth.SharedOrganization')
49
-
50
+ model_string = get_setting(
51
+ "SHARED_AUTH_ORGANIZATION_MODEL", "shared_auth.SharedOrganization"
52
+ )
53
+
50
54
  try:
51
55
  return apps.get_model(model_string, require_ready=False)
52
56
  except ValueError:
@@ -64,15 +68,15 @@ def get_organization_model():
64
68
  def get_user_model():
65
69
  """
66
70
  Retorna o model de User configurado ou o padrão.
67
-
71
+
68
72
  Usage:
69
73
  from shared_auth.utils import get_user_model
70
-
74
+
71
75
  User = get_user_model()
72
76
  user = User.objects.get(id=1)
73
77
  """
74
- model_string = get_setting('SHARED_AUTH_USER_MODEL', 'shared_auth.User')
75
-
78
+ model_string = get_setting("SHARED_AUTH_USER_MODEL", "shared_auth.User")
79
+
76
80
  try:
77
81
  return apps.get_model(model_string, require_ready=False)
78
82
  except ValueError:
@@ -90,15 +94,15 @@ def get_user_model():
90
94
  def get_member_model():
91
95
  """
92
96
  Retorna o model de Member configurado ou o padrão.
93
-
97
+
94
98
  Usage:
95
99
  from shared_auth.utils import get_member_model
96
-
100
+
97
101
  Member = get_member_model()
98
102
  member = Member.objects.get(id=1)
99
103
  """
100
- model_string = get_setting('SHARED_AUTH_MEMBER_MODEL', 'shared_auth.SharedMember')
101
-
104
+ model_string = get_setting("SHARED_AUTH_MEMBER_MODEL", "shared_auth.SharedMember")
105
+
102
106
  try:
103
107
  return apps.get_model(model_string, require_ready=False)
104
108
  except ValueError:
@@ -111,3 +115,15 @@ def get_member_model():
111
115
  f"SHARED_AUTH_MEMBER_MODEL refere-se ao model '{model_string}' "
112
116
  f"que não foi instalado ou é inválido."
113
117
  )
118
+
119
+
120
+ def get_organization_serializer():
121
+ model_string = get_setting("SHARED_AUTH_ORGANIZATION_SERIALIZER", None)
122
+
123
+ if not model_string:
124
+ return serializers.ModelSerializer
125
+
126
+ try:
127
+ return importlib.import_module(model_string)
128
+ except Exception:
129
+ return serializers.ModelSerializer