maquinaweb-shared-auth 0.2.18__py3-none-any.whl → 0.2.20__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.18.dist-info → maquinaweb_shared_auth-0.2.20.dist-info}/METADATA +1 -1
- {maquinaweb_shared_auth-0.2.18.dist-info → maquinaweb_shared_auth-0.2.20.dist-info}/RECORD +8 -8
- shared_auth/authentication.py +1 -1
- shared_auth/managers.py +2 -2
- shared_auth/middleware.py +3 -3
- shared_auth/permissions.py +2 -2
- {maquinaweb_shared_auth-0.2.18.dist-info → maquinaweb_shared_auth-0.2.20.dist-info}/WHEEL +0 -0
- {maquinaweb_shared_auth-0.2.18.dist-info → maquinaweb_shared_auth-0.2.20.dist-info}/top_level.txt +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
shared_auth/__init__.py,sha256=Ta8lIbyn22J6wU-TgWeSvdDHS4NBRf4Sv1Ag8VtY-bE,152
|
|
2
2
|
shared_auth/app.py,sha256=EHoLKlpW41o6ZxcH184aMhnWQxkVp9fH2_-89RjMz-4,215
|
|
3
|
-
shared_auth/authentication.py,sha256=
|
|
3
|
+
shared_auth/authentication.py,sha256=AidtDV4zBWkezN2H6iyOiRNrBoWGgcYiXQU1WkhfUIo,1409
|
|
4
4
|
shared_auth/conf.py,sha256=-jdnCokMvWvVKllfsxNYCsPk1Vo3MDRq4Y1MsO16oeA,411
|
|
5
5
|
shared_auth/decorators.py,sha256=RT-Qfi7oGBo6PvWJRR1dqJUQdU6ZOf9p-8mV3rZmqQ0,3237
|
|
6
6
|
shared_auth/exceptions.py,sha256=VKamHjBl2yjXG2RsMrLrXru1_Q9IJXmy4xmDcXlpWsU,627
|
|
7
7
|
shared_auth/fields.py,sha256=RAcmFh1D_nkbai_7t_OrPZhfhAipesy5kKnEj4LUvvM,1254
|
|
8
|
-
shared_auth/managers.py,sha256=
|
|
9
|
-
shared_auth/middleware.py,sha256=
|
|
8
|
+
shared_auth/managers.py,sha256=xRj8d5r2Q5pBi36dQAOasS7EPvUUehb0eFbA-sAuzxY,6727
|
|
9
|
+
shared_auth/middleware.py,sha256=72GF8kGijbhw98v2Q-1sXBXk-7Bamfyvypm9h8xLX_I,6112
|
|
10
10
|
shared_auth/mixins.py,sha256=BSYNTWYjLRGuxfy7x-uAaNZmrTMsm67ogAQzjrU2DoQ,7388
|
|
11
11
|
shared_auth/models.py,sha256=ow38lE2oDAVz2OplyTnGbGR7TeAmoDn3qUiyWn6Z1WE,6178
|
|
12
|
-
shared_auth/permissions.py,sha256=
|
|
12
|
+
shared_auth/permissions.py,sha256=FNIp12ePOUlXVp26zNMAyEtzX9kwyP7RuNIgaaCXtPA,2671
|
|
13
13
|
shared_auth/router.py,sha256=zYidJ7j40lQLrhkCtAQAp-rQLhua_UF0X7SDzYRcV5w,668
|
|
14
14
|
shared_auth/serializers.py,sha256=uhSrcmFgBUnIWUiKymQrsSNpFDTj3j1Eged2lPG2M0s,4588
|
|
15
15
|
shared_auth/urls.py,sha256=591wWEWJPaHEGkcOZ8yvfgxddRyOcZLgOc0vNtF7XRI,289
|
|
16
16
|
shared_auth/views.py,sha256=2hyLnYSWUscfq-jVcskt-ukzDt4vg6IXeKjRDRu9RXk,1519
|
|
17
|
-
maquinaweb_shared_auth-0.2.
|
|
18
|
-
maquinaweb_shared_auth-0.2.
|
|
19
|
-
maquinaweb_shared_auth-0.2.
|
|
20
|
-
maquinaweb_shared_auth-0.2.
|
|
17
|
+
maquinaweb_shared_auth-0.2.20.dist-info/METADATA,sha256=5A-fUa0amoWuWB_TwFeRxR7V2miYKTSyDfsnAm7zcaY,27151
|
|
18
|
+
maquinaweb_shared_auth-0.2.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
19
|
+
maquinaweb_shared_auth-0.2.20.dist-info/top_level.txt,sha256=msyYRy02ZV7zz7GR1raUI5LXGFIFn2TIkgkeKZqKufE,12
|
|
20
|
+
maquinaweb_shared_auth-0.2.20.dist-info/RECORD,,
|
shared_auth/authentication.py
CHANGED
|
@@ -28,7 +28,7 @@ class SharedTokenAuthentication(TokenAuthentication):
|
|
|
28
28
|
Valida o token no banco de dados compartilhado
|
|
29
29
|
"""
|
|
30
30
|
try:
|
|
31
|
-
token = SharedToken.objects.
|
|
31
|
+
token = SharedToken.objects.get(key=key)
|
|
32
32
|
except SharedToken.DoesNotExist:
|
|
33
33
|
raise exceptions.AuthenticationFailed(_("Token inválido."))
|
|
34
34
|
|
shared_auth/managers.py
CHANGED
|
@@ -69,11 +69,11 @@ class SharedMemberManager(models.Manager):
|
|
|
69
69
|
|
|
70
70
|
def for_user(self, user_id):
|
|
71
71
|
"""Retorna memberships de um usuário"""
|
|
72
|
-
return self.filter(user_id=user_id)
|
|
72
|
+
return self.filter(user_id=user_id)
|
|
73
73
|
|
|
74
74
|
def for_organization(self, organization_id):
|
|
75
75
|
"""Retorna membros de uma organização"""
|
|
76
|
-
return self.filter(organization_id=organization_id)
|
|
76
|
+
return self.filter(organization_id=organization_id)
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
class OrganizationQuerySetMixin:
|
shared_auth/middleware.py
CHANGED
|
@@ -201,7 +201,7 @@ class OrganizationMiddleware(MiddlewareMixin):
|
|
|
201
201
|
@staticmethod
|
|
202
202
|
def _validate_organization_membership(user, organization_id):
|
|
203
203
|
try:
|
|
204
|
-
member = get_member(user, organization_id)
|
|
204
|
+
member = get_member(user.pk, organization_id)
|
|
205
205
|
if not member and not user.is_superuser:
|
|
206
206
|
return None
|
|
207
207
|
return organization_id
|
|
@@ -209,7 +209,7 @@ class OrganizationMiddleware(MiddlewareMixin):
|
|
|
209
209
|
return None
|
|
210
210
|
|
|
211
211
|
|
|
212
|
-
def get_member(
|
|
212
|
+
def get_member(user_id, organization_id):
|
|
213
213
|
return SharedMember.objects.filter(
|
|
214
|
-
user_id=
|
|
214
|
+
user_id=user_id, organization_id=organization_id
|
|
215
215
|
).first()
|
shared_auth/permissions.py
CHANGED
|
@@ -61,7 +61,7 @@ class IsSameOrganization(permissions.BasePermission):
|
|
|
61
61
|
return True # Se objeto não tem org, permite
|
|
62
62
|
|
|
63
63
|
# Verifica se o usuário é membro da organização do objeto
|
|
64
|
-
if not get_member(request.user, obj.organization_id):
|
|
64
|
+
if not get_member(request.user.pk, obj.organization_id):
|
|
65
65
|
return False
|
|
66
66
|
|
|
67
67
|
return obj.organization_id == request.organization_id
|
|
@@ -84,7 +84,7 @@ class IsOwnerOrSameOrganization(permissions.BasePermission):
|
|
|
84
84
|
# Verificar se é da mesma organização
|
|
85
85
|
if hasattr(obj, "organization_id") and hasattr(request, "organization_id"):
|
|
86
86
|
# Verifica se o usuário é membro da organização do objeto
|
|
87
|
-
if get_member(request.user, obj.organization_id):
|
|
87
|
+
if get_member(request.user.pk, obj.organization_id):
|
|
88
88
|
return obj.organization_id == request.organization_id
|
|
89
89
|
|
|
90
90
|
return False
|
|
File without changes
|
{maquinaweb_shared_auth-0.2.18.dist-info → maquinaweb_shared_auth-0.2.20.dist-info}/top_level.txt
RENAMED
|
File without changes
|