maquinaweb-shared-auth 0.2.40__tar.gz → 0.2.41__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.
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/PKG-INFO +1 -1
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/maquinaweb_shared_auth.egg-info/PKG-INFO +1 -1
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/pyproject.toml +1 -1
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/middleware.py +16 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/mixins.py +4 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/README.md +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/maquinaweb_shared_auth.egg-info/SOURCES.txt +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/maquinaweb_shared_auth.egg-info/dependency_links.txt +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/maquinaweb_shared_auth.egg-info/requires.txt +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/maquinaweb_shared_auth.egg-info/top_level.txt +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/setup.cfg +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/setup.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/__init__.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/abstract_models.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/app.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/authentication.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/conf.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/decorators.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/exceptions.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/fields.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/managers.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/models.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/permissions.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/router.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/serializers.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/storage_backend.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/urls.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/utils.py +0 -0
- {maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/views.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "maquinaweb-shared-auth"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.41"
|
|
8
8
|
description = "Models read-only para autenticação compartilhada entre projetos Django."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.13"
|
|
@@ -166,7 +166,10 @@ class OrganizationMiddleware(MiddlewareMixin):
|
|
|
166
166
|
if not organization_id:
|
|
167
167
|
return
|
|
168
168
|
|
|
169
|
+
organization_ids = self._determine_organization_ids(request)
|
|
170
|
+
|
|
169
171
|
request.organization_id = organization_id
|
|
172
|
+
request.organization_ids = organization_ids
|
|
170
173
|
Organization = get_organization_model()
|
|
171
174
|
request.organization = Organization.objects.filter(pk=organization_id).first()
|
|
172
175
|
|
|
@@ -183,6 +186,9 @@ class OrganizationMiddleware(MiddlewareMixin):
|
|
|
183
186
|
|
|
184
187
|
return self._get_organization_from_user(request)
|
|
185
188
|
|
|
189
|
+
def _determine_organization_ids(self, request):
|
|
190
|
+
return self._get_organization_ids_from_user(request)
|
|
191
|
+
|
|
186
192
|
@staticmethod
|
|
187
193
|
def _get_organization_from_header(request):
|
|
188
194
|
if header_value := request.headers.get("X-Organization"):
|
|
@@ -206,6 +212,16 @@ class OrganizationMiddleware(MiddlewareMixin):
|
|
|
206
212
|
|
|
207
213
|
return member.organization_id if member else None
|
|
208
214
|
|
|
215
|
+
@staticmethod
|
|
216
|
+
def _get_organization_ids_from_user(request):
|
|
217
|
+
if not request.user.is_authenticated:
|
|
218
|
+
return None
|
|
219
|
+
|
|
220
|
+
Member = get_member_model()
|
|
221
|
+
member = Member.objects.filter(user_id=request.user.pk)
|
|
222
|
+
|
|
223
|
+
return member.values_list("organization_id", flat=True) if member else None
|
|
224
|
+
|
|
209
225
|
@staticmethod
|
|
210
226
|
def _validate_organization_membership(user, organization_id):
|
|
211
227
|
try:
|
|
@@ -219,6 +219,10 @@ class LoggedOrganizationMixin(viewsets.ModelViewSet):
|
|
|
219
219
|
"""Obtém o ID da organização logada via maquinaweb-shared-auth"""
|
|
220
220
|
return self.request.organization_id
|
|
221
221
|
|
|
222
|
+
def get_organization_ids(self):
|
|
223
|
+
"""Obtém os IDs das organizações permitidas via maquinaweb-shared-auth"""
|
|
224
|
+
return self.request.organization_ids
|
|
225
|
+
|
|
222
226
|
def get_user(self):
|
|
223
227
|
"""Obtém o usuário atual autenticado"""
|
|
224
228
|
return self.request.user
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/abstract_models.py
RENAMED
|
File without changes
|
|
File without changes
|
{maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/authentication.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{maquinaweb_shared_auth-0.2.40 → maquinaweb_shared_auth-0.2.41}/shared_auth/storage_backend.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|