simo 2.5.17__py3-none-any.whl → 2.5.18__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 simo might be problematic. Click here for more details.
- simo/core/__pycache__/signal_receivers.cpython-38.pyc +0 -0
- simo/core/__pycache__/tasks.cpython-38.pyc +0 -0
- simo/core/signal_receivers.py +1 -13
- simo/core/tasks.py +21 -3
- simo/users/__pycache__/admin.cpython-38.pyc +0 -0
- simo/users/__pycache__/managers.cpython-38.pyc +0 -0
- simo/users/admin.py +2 -7
- simo/users/managers.py +4 -3
- {simo-2.5.17.dist-info → simo-2.5.18.dist-info}/METADATA +1 -1
- {simo-2.5.17.dist-info → simo-2.5.18.dist-info}/RECORD +14 -14
- {simo-2.5.17.dist-info → simo-2.5.18.dist-info}/LICENSE.md +0 -0
- {simo-2.5.17.dist-info → simo-2.5.18.dist-info}/WHEEL +0 -0
- {simo-2.5.17.dist-info → simo-2.5.18.dist-info}/entry_points.txt +0 -0
- {simo-2.5.17.dist-info → simo-2.5.18.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
Binary file
|
simo/core/signal_receivers.py
CHANGED
|
@@ -238,16 +238,4 @@ def gateway_post_save(sender, instance, created, *args, **kwargs):
|
|
|
238
238
|
|
|
239
239
|
@receiver(post_delete, sender=Gateway)
|
|
240
240
|
def gateway_post_delete(sender, instance, *args, **kwargs):
|
|
241
|
-
instance.stop()
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
@receiver(post_save, sender=Instance)
|
|
245
|
-
def post_instance_save(sender, instance, created, **kwargs):
|
|
246
|
-
if created:
|
|
247
|
-
from simo.users.models import PermissionsRole
|
|
248
|
-
PermissionsRole.objects.create(
|
|
249
|
-
instance=instance, name='Owner', can_manage_users=True,
|
|
250
|
-
)
|
|
251
|
-
PermissionsRole.objects.create(
|
|
252
|
-
instance=instance, name='User', can_manage_users=False, is_default=True
|
|
253
|
-
)
|
|
241
|
+
instance.stop()
|
simo/core/tasks.py
CHANGED
|
@@ -214,8 +214,13 @@ def sync_with_remote():
|
|
|
214
214
|
weather_component.controller.set(weather)
|
|
215
215
|
weather_component.save()
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
print(f"NEW INSTANCE: {instance}")
|
|
218
|
+
print(f"Users data: {users_data}")
|
|
219
|
+
|
|
218
220
|
|
|
221
|
+
for email, options in users_data.items():
|
|
222
|
+
print(f"EMAIL: {email}")
|
|
223
|
+
print(f"OPTIONS: {options}")
|
|
219
224
|
if new_instance or not instance.instance_users.count():
|
|
220
225
|
# Create user for new instance!
|
|
221
226
|
user, new_user = User.objects.get_or_create(
|
|
@@ -224,21 +229,34 @@ def sync_with_remote():
|
|
|
224
229
|
'is_master': options.get('is_hub_master', False),
|
|
225
230
|
})
|
|
226
231
|
role = None
|
|
227
|
-
if options.get('
|
|
232
|
+
if options.get('is_superuser'):
|
|
233
|
+
print(f"Try getting superuser role!")
|
|
228
234
|
role = PermissionsRole.objects.filter(
|
|
229
235
|
instance=instance, is_superuser=True
|
|
230
236
|
).first()
|
|
237
|
+
if role:
|
|
238
|
+
print("ROLE FOUND: ", role)
|
|
239
|
+
else:
|
|
240
|
+
print("NO such a role.")
|
|
231
241
|
elif options.get('is_owner'):
|
|
242
|
+
print(f"Try getting owner role!")
|
|
232
243
|
role = PermissionsRole.objects.filter(
|
|
233
|
-
instance=instance, is_owner=True
|
|
244
|
+
instance=instance, is_owner=True, is_superuser=False
|
|
234
245
|
).first()
|
|
246
|
+
if role:
|
|
247
|
+
print("ROLE FOUND: ", role)
|
|
248
|
+
else:
|
|
249
|
+
print("NO such a role.")
|
|
235
250
|
|
|
236
251
|
if role:
|
|
252
|
+
print("Creating InstanceUser!")
|
|
237
253
|
InstanceUser.objects.update_or_create(
|
|
238
254
|
user=user, instance=instance, defaults={
|
|
239
255
|
'is_active': True, 'role': role
|
|
240
256
|
}
|
|
241
257
|
)
|
|
258
|
+
else:
|
|
259
|
+
print("Instance User was not created!")
|
|
242
260
|
else:
|
|
243
261
|
user = User.objects.filter(email=email).first()
|
|
244
262
|
|
|
Binary file
|
|
Binary file
|
simo/users/admin.py
CHANGED
|
@@ -25,15 +25,10 @@ class ComponentPermissionInline(admin.TabularInline):
|
|
|
25
25
|
|
|
26
26
|
@admin.register(PermissionsRole)
|
|
27
27
|
class PermissionsRoleAdmin(admin.ModelAdmin):
|
|
28
|
-
list_display = 'name', 'is_superuser', 'is_default'
|
|
28
|
+
list_display = 'name', 'is_superuser', 'is_owner', 'can_manage_users', 'is_default'
|
|
29
29
|
search_fields = 'name',
|
|
30
30
|
inlines = ComponentPermissionInline,
|
|
31
|
-
|
|
32
|
-
def get_queryset(self, request):
|
|
33
|
-
qs = super().get_queryset(request)
|
|
34
|
-
if request.user.is_master:
|
|
35
|
-
return qs
|
|
36
|
-
return qs.filter(instance=request.instance)
|
|
31
|
+
list_filter = 'is_superuser', 'is_owner', 'can_manage_users', 'is_default'
|
|
37
32
|
|
|
38
33
|
def save_model(self, request, obj, form, change):
|
|
39
34
|
if not obj.id:
|
simo/users/managers.py
CHANGED
|
@@ -5,7 +5,8 @@ from simo.core.middleware import get_current_instance
|
|
|
5
5
|
class ActiveInstanceManager(models.Manager):
|
|
6
6
|
|
|
7
7
|
def get_queryset(self):
|
|
8
|
+
qs = super().get_queryset()
|
|
8
9
|
instance = get_current_instance()
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
if instance:
|
|
11
|
+
return qs.filter(instance=instance)
|
|
12
|
+
return qs
|
|
@@ -56,10 +56,10 @@ simo/core/models.py,sha256=DXJXTtNdpn9yC4VArHp0yrhpRb7vGpwH2c-JvqLE56M,22784
|
|
|
56
56
|
simo/core/permissions.py,sha256=v0iJM4LOeYoEfMiw3OLPYio272G1aUEAg_z9Wd1q5m0,2993
|
|
57
57
|
simo/core/routing.py,sha256=X1_IHxyA-_Q7hw1udDoviVP4_FSBDl8GYETTC2zWTbY,499
|
|
58
58
|
simo/core/serializers.py,sha256=WgksN1Ombv240nfQR_UtmKslTWM9vz9Y0yTdN5usiHU,21892
|
|
59
|
-
simo/core/signal_receivers.py,sha256
|
|
59
|
+
simo/core/signal_receivers.py,sha256=YZZVg0MHIqfJ4RxG_KH5G5pkVz97SLXsMkMxpo-ec2I,8842
|
|
60
60
|
simo/core/socket_consumers.py,sha256=trRZvBGTJ7xIbfdmVvn7zoiWp_qssSkMZykDrI5YQyE,9783
|
|
61
61
|
simo/core/storage.py,sha256=_5igjaoWZAiExGWFEJMElxUw55DzJG1jqFty33xe8BE,342
|
|
62
|
-
simo/core/tasks.py,sha256=
|
|
62
|
+
simo/core/tasks.py,sha256=j1A7nFVQ1LfjIZ1SCcjiEst_I8xHmpRwCUuuoZyCTG4,15853
|
|
63
63
|
simo/core/todos.py,sha256=eYVXfLGiapkxKK57XuviSNe3WsUYyIWZ0hgQJk7ThKo,665
|
|
64
64
|
simo/core/types.py,sha256=WJEq48mIbFi_5Alt4wxWMGXxNxUTXqfQU5koH7wqHHI,1108
|
|
65
65
|
simo/core/views.py,sha256=3SRZr00fyLQf8ja3U-9eekKt-ld5TvU1WQqUWprXfQ4,2390
|
|
@@ -89,10 +89,10 @@ simo/core/__pycache__/models.cpython-38.pyc,sha256=HGL3TiaMy-0oobgCGGxH2nvDhh4Rn
|
|
|
89
89
|
simo/core/__pycache__/permissions.cpython-38.pyc,sha256=fH4iyqd9DdzRLEu2b621-FeM-napR0M7hzBUTHo9Q3g,2972
|
|
90
90
|
simo/core/__pycache__/routing.cpython-38.pyc,sha256=3T3FPJ8Cn99xZCGvMyg2xjl7al-Shm9CelbSpkJtNP8,599
|
|
91
91
|
simo/core/__pycache__/serializers.cpython-38.pyc,sha256=d4wpUjFuo8GxaNWbin9GdHKik06IZN32uZL1SnXiL_s,19616
|
|
92
|
-
simo/core/__pycache__/signal_receivers.cpython-38.pyc,sha256=
|
|
92
|
+
simo/core/__pycache__/signal_receivers.cpython-38.pyc,sha256=bBnV6L69VVH46nrWDHi4VGBEMcxusfEsXN7aZoQRzDI,6729
|
|
93
93
|
simo/core/__pycache__/socket_consumers.cpython-38.pyc,sha256=KqbO1cOewodVPcy0-htVefyUjCuELKV0o7fOfYqfgPc,8490
|
|
94
94
|
simo/core/__pycache__/storage.cpython-38.pyc,sha256=9R1Xu0FJDflfRXUPsqEgt0SpwiP7FGk7HaR8s8XRyI8,721
|
|
95
|
-
simo/core/__pycache__/tasks.cpython-38.pyc,sha256=
|
|
95
|
+
simo/core/__pycache__/tasks.cpython-38.pyc,sha256=H6Bjaqh6ua_naPZstKLUURvSvIob_9GnEjo1rPX06po,10750
|
|
96
96
|
simo/core/__pycache__/todos.cpython-38.pyc,sha256=lOqGZ58siHM3isoJV4r7sg8igrfE9fFd-jSfeBa0AQI,253
|
|
97
97
|
simo/core/__pycache__/views.cpython-38.pyc,sha256=K_QM967bIJeU02DJu0Dm7j8RiFDKn_TLzX77YzNkA7c,2495
|
|
98
98
|
simo/core/__pycache__/widgets.cpython-38.pyc,sha256=sR0ZeHCHrhnNDBJuRrxp3zUsfBp0xrtF0xrK2TkQv1o,3520
|
|
@@ -10442,13 +10442,13 @@ simo/notifications/migrations/__pycache__/0002_notification_instance.cpython-38.
|
|
|
10442
10442
|
simo/notifications/migrations/__pycache__/0003_alter_notification_instance.cpython-38.pyc,sha256=awhD1F9RyK_706zVNM5io3WT_konFkKQgL7D5MkONwk,851
|
|
10443
10443
|
simo/notifications/migrations/__pycache__/__init__.cpython-38.pyc,sha256=YMBRHVon2nWDtIUbghckjnC12sIg_ykPWhV5aM0tto4,178
|
|
10444
10444
|
simo/users/__init__.py,sha256=6a7uBpCWB_DR7p54rbHusc0xvi1qfT1ZCCQGb6TiBh8,52
|
|
10445
|
-
simo/users/admin.py,sha256=
|
|
10445
|
+
simo/users/admin.py,sha256=WDRJJtEkbYBQFtLg_5VOIlBV0eeJhgmrsFL51ttme0w,6760
|
|
10446
10446
|
simo/users/api.py,sha256=FdBd3D_TSrTXk1zTPtLTqppbDsf_siTvTHROjWe3Wzo,12066
|
|
10447
10447
|
simo/users/apps.py,sha256=cq0A8-U1HALEwev0TicgFhr4CAu7Icz8rwq0HfOaL4E,207
|
|
10448
10448
|
simo/users/auth_backends.py,sha256=bBSNXQJ88TRXaQxyh1aETfmOIfiDr08Jnj8rSY9sHDk,4074
|
|
10449
10449
|
simo/users/auto_urls.py,sha256=lcJvteBsbHQMJieZpDz-63tDYejLApqsW3CUnDakd7k,272
|
|
10450
10450
|
simo/users/dynamic_settings.py,sha256=sEIsi4yJw3kH46Jq_aOkSuK7QTfQACGUE-lkyBogCaM,570
|
|
10451
|
-
simo/users/managers.py,sha256=
|
|
10451
|
+
simo/users/managers.py,sha256=Dm21Avmu38-h8MsZ5ljtpgKihMGUBU4hHGpiPvp4NtM,323
|
|
10452
10452
|
simo/users/middleware.py,sha256=GMCrnWSc_2qCleyQIkfQGdL-pU-UTEcSg1wPvIKZ9uk,1210
|
|
10453
10453
|
simo/users/models.py,sha256=YXermRuV6LFndyUMiaYcTxC1kpgG0GLeJCczGJuCy10,19251
|
|
10454
10454
|
simo/users/permissions.py,sha256=IwtYS8yQdupWbYKR9VimSRDV3qCJ2jXP57Lyjpb2EQM,242
|
|
@@ -10459,13 +10459,13 @@ simo/users/tasks.py,sha256=HJAqiyWGsaN3wSfquU0UyQ20jL-njXeaaTOdDT3TQ3s,979
|
|
|
10459
10459
|
simo/users/utils.py,sha256=1HGSZyHRqQvdJ4RtAiZDg1juvgG8aOlrGXR7CcvsyQc,1886
|
|
10460
10460
|
simo/users/views.py,sha256=dOQVvmlHG7ihWKJLFUBcqKOA0UDctlMKR0pTc36JZqg,3487
|
|
10461
10461
|
simo/users/__pycache__/__init__.cpython-38.pyc,sha256=VFoDJE_SKKaPqqYaaBYd1Ndb1hjakkTo_u0EG_XJ1GM,211
|
|
10462
|
-
simo/users/__pycache__/admin.cpython-38.pyc,sha256=
|
|
10462
|
+
simo/users/__pycache__/admin.cpython-38.pyc,sha256=5LEDivt0AydPmqk9PCKvlKRRtc3QBxA6hZgcy_8bEQU,7680
|
|
10463
10463
|
simo/users/__pycache__/api.cpython-38.pyc,sha256=As8xBUdgmpVeUYCRCR5ZH0aU9vLdEXgnZL6TR3wAhrY,10200
|
|
10464
10464
|
simo/users/__pycache__/apps.cpython-38.pyc,sha256=dgbWL8CxzzISJQTmq_4IztPJ2UzykNVdqA2Ae1PmeGk,605
|
|
10465
10465
|
simo/users/__pycache__/auth_backends.cpython-38.pyc,sha256=n5nx2QSXNj2idzRcGE6bAagMN-8qxoCs580H1EFZXls,3105
|
|
10466
10466
|
simo/users/__pycache__/auto_urls.cpython-38.pyc,sha256=K-3sz2h-cEitoflSmZk1t0eUg5mQMMGLNZFREVwG7_o,430
|
|
10467
10467
|
simo/users/__pycache__/dynamic_settings.cpython-38.pyc,sha256=6F8JBjZkHykySnmZjNEzjS0ijbmPdcp9yUAZ5kqq_Fo,864
|
|
10468
|
-
simo/users/__pycache__/managers.cpython-38.pyc,sha256=
|
|
10468
|
+
simo/users/__pycache__/managers.cpython-38.pyc,sha256=oAy5mRBI-FQWgx9xgQsHmCiknKqojuVY363mfEVK0i8,697
|
|
10469
10469
|
simo/users/__pycache__/middleware.cpython-38.pyc,sha256=Tj4nVEAvxEW3xA63fBRiJWRJpz_M848ZOqbHioc_IPE,1149
|
|
10470
10470
|
simo/users/__pycache__/models.cpython-38.pyc,sha256=oQnLCmCFOJ_L_NzkjokSFKmGO-RZWkOsWEQpwS7k_AA,17873
|
|
10471
10471
|
simo/users/__pycache__/permissions.cpython-38.pyc,sha256=ez5NxoL_JUeeH6GsKhvFreuA3FCBgGf9floSypdXUtM,633
|
|
@@ -10561,9 +10561,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
|
|
|
10561
10561
|
simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10562
10562
|
simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10563
10563
|
simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10564
|
-
simo-2.5.
|
|
10565
|
-
simo-2.5.
|
|
10566
|
-
simo-2.5.
|
|
10567
|
-
simo-2.5.
|
|
10568
|
-
simo-2.5.
|
|
10569
|
-
simo-2.5.
|
|
10564
|
+
simo-2.5.18.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
|
|
10565
|
+
simo-2.5.18.dist-info/METADATA,sha256=D6hINl3wkYn5K7lK2J8DSaS2bkCeZ70vQVUMqemiXfA,1924
|
|
10566
|
+
simo-2.5.18.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
10567
|
+
simo-2.5.18.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
|
|
10568
|
+
simo-2.5.18.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
|
|
10569
|
+
simo-2.5.18.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|