simo 1.7.9__py3-none-any.whl → 1.7.10__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/generic/controllers.py +7 -0
- simo/users/__pycache__/models.cpython-38.pyc +0 -0
- simo/users/middleware.py +14 -1
- simo/users/models.py +4 -0
- {simo-1.7.9.dist-info → simo-1.7.10.dist-info}/METADATA +1 -1
- {simo-1.7.9.dist-info → simo-1.7.10.dist-info}/RECORD +9 -9
- {simo-1.7.9.dist-info → simo-1.7.10.dist-info}/LICENSE.md +0 -0
- {simo-1.7.9.dist-info → simo-1.7.10.dist-info}/WHEEL +0 -0
- {simo-1.7.9.dist-info → simo-1.7.10.dist-info}/top_level.txt +0 -0
simo/generic/controllers.py
CHANGED
|
@@ -9,6 +9,8 @@ from django.utils.translation import gettext_lazy as _
|
|
|
9
9
|
from django.conf import settings
|
|
10
10
|
from django.urls import reverse_lazy
|
|
11
11
|
from simo.conf import dynamic_settings
|
|
12
|
+
from simo.users.middleware import get_current_user, introduce
|
|
13
|
+
from simo.users.utils import get_system_user
|
|
12
14
|
from simo.core.events import ObjectCommand
|
|
13
15
|
from simo.core.models import RUN_STATUS_CHOICES_MAP, Component
|
|
14
16
|
from simo.core.utils.helpers import get_random_string
|
|
@@ -241,6 +243,9 @@ class Thermostat(ControllerBase):
|
|
|
241
243
|
low = target_temp - self.component.config['reaction_difference'] / 2
|
|
242
244
|
high = target_temp + self.component.config['reaction_difference'] / 2
|
|
243
245
|
|
|
246
|
+
if not get_current_user():
|
|
247
|
+
introduce(get_system_user())
|
|
248
|
+
|
|
244
249
|
if mode in ('auto', 'heater'):
|
|
245
250
|
if (not heater or not heater.alive) and mode == 'heater':
|
|
246
251
|
print(f"No heater on {self.component}!")
|
|
@@ -934,6 +939,7 @@ class Watering(ControllerBase):
|
|
|
934
939
|
minute_to_start -= 24*60
|
|
935
940
|
|
|
936
941
|
if minute_to_start <= local_minute < minute_to_start + gap:
|
|
942
|
+
introduce(get_system_user())
|
|
937
943
|
self.reset()
|
|
938
944
|
self.start()
|
|
939
945
|
|
|
@@ -1184,6 +1190,7 @@ class AlarmClock(ControllerBase):
|
|
|
1184
1190
|
continue
|
|
1185
1191
|
if event['uid'] in current_value['events_triggered']:
|
|
1186
1192
|
continue
|
|
1193
|
+
introduce(get_system_user())
|
|
1187
1194
|
self._execute_event(event)
|
|
1188
1195
|
current_value['events_triggered'].append(event['uid'])
|
|
1189
1196
|
|
|
Binary file
|
simo/users/middleware.py
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import threading
|
|
3
3
|
|
|
4
|
+
# This is only ment for logging component history actions.
|
|
5
|
+
# Do not use this for anything permissions related!
|
|
6
|
+
|
|
7
|
+
# This technique can only be used with asgi/wsgi runners that
|
|
8
|
+
# are not performing thread swapping for handling simultaneous requests.
|
|
9
|
+
# For example gunicorn does that when configured with more than one worker,
|
|
10
|
+
# which eventually messes up this system.
|
|
11
|
+
|
|
12
|
+
# We use daphne for asgi, which seems to be working fine for what we have already
|
|
13
|
+
# observed. However, this is a good candidate for reworking it in to something
|
|
14
|
+
# more rboust.
|
|
15
|
+
|
|
16
|
+
# TODO: rework this in to something more roboust
|
|
17
|
+
|
|
4
18
|
_thread_locals = threading.local()
|
|
5
19
|
|
|
6
20
|
|
|
7
21
|
def get_current_user():
|
|
8
|
-
#TODO: VERY BAD PRACTICE!!! DROP THIS!
|
|
9
22
|
try:
|
|
10
23
|
return getattr(_thread_locals, 'user')
|
|
11
24
|
except:
|
simo/users/models.py
CHANGED
|
@@ -255,6 +255,10 @@ class User(AbstractBaseUser, SimoAdminMixin):
|
|
|
255
255
|
|
|
256
256
|
@property
|
|
257
257
|
def is_active(self):
|
|
258
|
+
if self.is_master and not self.instance_roles.all():
|
|
259
|
+
# Master that has no roles on any instance is in GOD mode!
|
|
260
|
+
# It can not be disabled by anybody, nor it is seen by anybody. :)
|
|
261
|
+
return True
|
|
258
262
|
if self._instance:
|
|
259
263
|
return bool(
|
|
260
264
|
self.instance_roles.filter(
|
|
@@ -10188,7 +10188,7 @@ simo/fleet/migrations/__pycache__/__init__.cpython-38.pyc,sha256=5k1KW0jeSDzw6Rn
|
|
|
10188
10188
|
simo/generic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10189
10189
|
simo/generic/app_widgets.py,sha256=E_pnpA1hxMIhenRCrHoQ5cik06jm2BAHCkl_eo-OudU,1264
|
|
10190
10190
|
simo/generic/base_types.py,sha256=djymox_boXTHX1BTTCLXrCH7ED-uAsV_idhaDOc3OLI,409
|
|
10191
|
-
simo/generic/controllers.py,sha256=
|
|
10191
|
+
simo/generic/controllers.py,sha256=AgOOVQrIEm8_6__BMme2tB05BSGm4V15miKQhhu5dDc,51752
|
|
10192
10192
|
simo/generic/forms.py,sha256=zF-QYfu6C0TZ7sJ5_-VkhUweV0_J8gg0CC07At6RIK8,19829
|
|
10193
10193
|
simo/generic/gateways.py,sha256=Pp29L_2AoZ_4nW6rLHmDCbDoac-yK9evJ1ZTcfMOItc,14807
|
|
10194
10194
|
simo/generic/models.py,sha256=XG8VnLSpMSiBnbKwvMknF9J9kdbmBolXvJ9L3Giz8pQ,3330
|
|
@@ -10285,8 +10285,8 @@ simo/users/api.py,sha256=_1Z8m4pU-9LAbLfSdZ6qXLj0amgulVPqmLX2kRGJWF4,7886
|
|
|
10285
10285
|
simo/users/auth_backends.py,sha256=I5pnaTa20-Lxfw_dFG8471xDITb0_fQl1PVhJalp5vU,3992
|
|
10286
10286
|
simo/users/auto_urls.py,sha256=ee0d6fWABkJY5mQOTC8KhrqDI6d8xZkYZ4ja-gZJ-rw,269
|
|
10287
10287
|
simo/users/dynamic_settings.py,sha256=sEIsi4yJw3kH46Jq_aOkSuK7QTfQACGUE-lkyBogCaM,570
|
|
10288
|
-
simo/users/middleware.py,sha256=
|
|
10289
|
-
simo/users/models.py,sha256=
|
|
10288
|
+
simo/users/middleware.py,sha256=9epN8xDcnYAMoEjAeJGg4W9e54szTgh48LKz3rlywFI,1287
|
|
10289
|
+
simo/users/models.py,sha256=aSWcLp-UCrLgebYca5-w2Vnbgqe2da3AOFDGbrXsMXI,17247
|
|
10290
10290
|
simo/users/permissions.py,sha256=IwtYS8yQdupWbYKR9VimSRDV3qCJ2jXP57Lyjpb2EQM,242
|
|
10291
10291
|
simo/users/serializers.py,sha256=Mh2pWmsKDp7CNIxK2OTw3CfVkteZHiVoXWNF1fluvX8,2161
|
|
10292
10292
|
simo/users/sso_urls.py,sha256=pcb_GhYHRtmairxJhMXE1bdcTma0BcYfKU3nCRtHQMQ,244
|
|
@@ -10301,7 +10301,7 @@ simo/users/__pycache__/auth_backends.cpython-38.pyc,sha256=BMVsMoWcoYUQevvj-2OSJ
|
|
|
10301
10301
|
simo/users/__pycache__/auto_urls.cpython-38.pyc,sha256=UCgzFKwKi1_W9jTQ2BBFq7GF7Q-wbP8r-d4Jsw8644c,423
|
|
10302
10302
|
simo/users/__pycache__/dynamic_settings.cpython-38.pyc,sha256=dexiY5hjMsvBrxCb5_ww1rlETHtSihVRLS_j_-dLCSw,856
|
|
10303
10303
|
simo/users/__pycache__/middleware.cpython-38.pyc,sha256=L1kh7QWOsrpBd6yfaiG-3MGdsB3hm-HWOzHPMUbtMnU,1165
|
|
10304
|
-
simo/users/__pycache__/models.cpython-38.pyc,sha256=
|
|
10304
|
+
simo/users/__pycache__/models.cpython-38.pyc,sha256=C1RmjoSBn6aBV7SkFKPNf3uqo2hNlRqKhcEuM1JOn3E,16563
|
|
10305
10305
|
simo/users/__pycache__/permissions.cpython-38.pyc,sha256=bIV9s6Y4uTX6KisJeWA_MZZ7aaDuIKu0sSYIPMXUCoo,625
|
|
10306
10306
|
simo/users/__pycache__/serializers.cpython-38.pyc,sha256=XtCwvcq1BT0pVVPrmjF59ME3V9kP2Or-QAzV2ozwiR0,2868
|
|
10307
10307
|
simo/users/__pycache__/sso_urls.cpython-38.pyc,sha256=DlIv-bsQRFX1LI-sr-COJb8Ah1iuAvaiVIZtY7fD2WI,395
|
|
@@ -10362,8 +10362,8 @@ simo/users/templates/invitations/expired_msg.html,sha256=3hTtUm-Cr1axOjlwAIKsSj9
|
|
|
10362
10362
|
simo/users/templates/invitations/expired_suggestion.html,sha256=pT67ludJdeohrlF0QIzs4eqy1SI_oH2i6H0ecEIgaCg,100
|
|
10363
10363
|
simo/users/templates/invitations/taken_msg.html,sha256=Dv1MaxVVmSdL20gri4Ei-K0aZ0OTmIdmO6a3l5MKwCs,445
|
|
10364
10364
|
simo/users/templates/invitations/taken_suggestion.html,sha256=NCE2XQail0WQGW8v6y3BkQoM3IOWlh02z9XPEws659E,301
|
|
10365
|
-
simo-1.7.
|
|
10366
|
-
simo-1.7.
|
|
10367
|
-
simo-1.7.
|
|
10368
|
-
simo-1.7.
|
|
10369
|
-
simo-1.7.
|
|
10365
|
+
simo-1.7.10.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
|
|
10366
|
+
simo-1.7.10.dist-info/METADATA,sha256=xRuEwYtKb2OMY_lpMvvyj1ipx31C0jHOTnUV67nTgWM,1749
|
|
10367
|
+
simo-1.7.10.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
10368
|
+
simo-1.7.10.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
|
|
10369
|
+
simo-1.7.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|