simo 1.7.19__py3-none-any.whl → 2.0.0__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/__pycache__/asgi.cpython-38.pyc +0 -0
- simo/__pycache__/on_http_start.cpython-38.pyc +0 -0
- simo/__pycache__/settings.cpython-38.pyc +0 -0
- simo/__pycache__/urls.cpython-38.pyc +0 -0
- simo/__pycache__/wsgi.cpython-38.pyc +0 -0
- simo/core/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/__pycache__/admin.cpython-38.pyc +0 -0
- simo/core/__pycache__/api.cpython-38.pyc +0 -0
- simo/core/__pycache__/api_meta.cpython-38.pyc +0 -0
- simo/core/__pycache__/auto_urls.cpython-38.pyc +0 -0
- simo/core/__pycache__/autocomplete_views.cpython-38.pyc +0 -0
- simo/core/__pycache__/base_types.cpython-38.pyc +0 -0
- simo/core/__pycache__/context.cpython-38.pyc +0 -0
- simo/core/__pycache__/controllers.cpython-38.pyc +0 -0
- simo/core/__pycache__/events.cpython-38.pyc +0 -0
- simo/core/__pycache__/filters.cpython-38.pyc +0 -0
- simo/core/__pycache__/forms.cpython-38.pyc +0 -0
- simo/core/__pycache__/gateways.cpython-38.pyc +0 -0
- simo/core/__pycache__/managers.cpython-38.pyc +0 -0
- simo/core/__pycache__/middleware.cpython-38.pyc +0 -0
- simo/core/__pycache__/models.cpython-38.pyc +0 -0
- simo/core/__pycache__/permissions.cpython-38.pyc +0 -0
- simo/core/__pycache__/routing.cpython-38.pyc +0 -0
- simo/core/__pycache__/serializers.cpython-38.pyc +0 -0
- simo/core/__pycache__/signal_receivers.cpython-38.pyc +0 -0
- simo/core/__pycache__/socket_consumers.cpython-38.pyc +0 -0
- simo/core/__pycache__/tasks.cpython-38.pyc +0 -0
- simo/core/__pycache__/todos.cpython-38.pyc +0 -0
- simo/core/__pycache__/views.cpython-38.pyc +0 -0
- simo/core/admin.py +28 -18
- simo/core/api.py +157 -16
- simo/core/api_meta.py +87 -0
- simo/core/auto_urls.py +4 -1
- simo/core/autocomplete_views.py +8 -4
- simo/core/base_types.py +1 -0
- simo/core/context.py +3 -1
- simo/core/controllers.py +112 -32
- simo/core/db_backend/base.py +7 -22
- simo/core/drf_braces/README +3 -0
- simo/core/drf_braces/__init__.py +7 -0
- simo/core/drf_braces/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/drf_braces/__pycache__/utils.cpython-38.pyc +0 -0
- simo/core/drf_braces/fields/__init__.py +5 -0
- simo/core/drf_braces/fields/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/drf_braces/fields/__pycache__/_fields.cpython-38.pyc +0 -0
- simo/core/drf_braces/fields/__pycache__/custom.cpython-38.pyc +0 -0
- simo/core/drf_braces/fields/__pycache__/mixins.cpython-38.pyc +0 -0
- simo/core/drf_braces/fields/__pycache__/modified.cpython-38.pyc +0 -0
- simo/core/drf_braces/fields/_fields.py +48 -0
- simo/core/drf_braces/fields/custom.py +107 -0
- simo/core/drf_braces/fields/mixins.py +58 -0
- simo/core/drf_braces/fields/modified.py +41 -0
- simo/core/drf_braces/forms/__init__.py +0 -0
- simo/core/drf_braces/forms/fields.py +20 -0
- simo/core/drf_braces/forms/serializer_form.py +156 -0
- simo/core/drf_braces/mixins.py +52 -0
- simo/core/drf_braces/models.py +0 -0
- simo/core/drf_braces/parsers.py +72 -0
- simo/core/drf_braces/renderers.py +37 -0
- simo/core/drf_braces/serializers/__init__.py +0 -0
- simo/core/drf_braces/serializers/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/drf_braces/serializers/__pycache__/form_serializer.cpython-38.pyc +0 -0
- simo/core/drf_braces/serializers/enforce_validation_serializer.py +214 -0
- simo/core/drf_braces/serializers/form_serializer.py +391 -0
- simo/core/drf_braces/serializers/swapping.py +48 -0
- simo/core/drf_braces/tests/__init__.py +0 -0
- simo/core/drf_braces/tests/fields/__init__.py +0 -0
- simo/core/drf_braces/tests/fields/test_custom.py +94 -0
- simo/core/drf_braces/tests/fields/test_fields.py +13 -0
- simo/core/drf_braces/tests/fields/test_mixins.py +96 -0
- simo/core/drf_braces/tests/fields/test_modified.py +40 -0
- simo/core/drf_braces/tests/forms/__init__.py +0 -0
- simo/core/drf_braces/tests/forms/test_fields.py +46 -0
- simo/core/drf_braces/tests/forms/test_serializer_form.py +256 -0
- simo/core/drf_braces/tests/serializers/__init__.py +0 -0
- simo/core/drf_braces/tests/serializers/test_enforce_validation_serializer.py +169 -0
- simo/core/drf_braces/tests/serializers/test_form_serializer.py +387 -0
- simo/core/drf_braces/tests/serializers/test_swapping.py +40 -0
- simo/core/drf_braces/tests/test_mixins.py +111 -0
- simo/core/drf_braces/tests/test_parsers.py +73 -0
- simo/core/drf_braces/tests/test_renderers.py +23 -0
- simo/core/drf_braces/tests/test_utils.py +73 -0
- simo/core/drf_braces/utils.py +209 -0
- simo/core/events.py +3 -3
- simo/core/forms.py +79 -37
- simo/core/gateways.py +31 -14
- simo/core/management/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/management/commands/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/management/commands/gateways_manager.py +0 -1
- simo/core/managers.py +81 -0
- simo/core/middleware.py +25 -0
- simo/core/migrations/0026_category_instance.py +20 -0
- simo/core/migrations/0027_remove_component_tags.py +17 -0
- simo/core/migrations/0028_rename_subcomponents_component_slaves.py +18 -0
- simo/core/migrations/0029_auto_20240229_1331.py +33 -0
- simo/core/migrations/__pycache__/0026_category_instance.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0027_remove_component_tags.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0028_rename_subcomponents_component_slaves.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0029_auto_20240229_1331.cpython-38.pyc +0 -0
- simo/core/models.py +103 -66
- simo/core/permissions.py +28 -2
- simo/core/serializers.py +330 -26
- simo/core/socket_consumers.py +5 -14
- simo/core/tasks.py +11 -1
- simo/core/templates/admin/base.html +37 -10
- simo/core/templates/admin/wizard/discovery.html +188 -0
- simo/core/templates/admin/wizard/wizard_add.html +5 -5
- simo/core/utils/__pycache__/serialization.cpython-38.pyc +0 -0
- simo/core/utils/admin.py +9 -2
- simo/core/utils/formsets.py +17 -16
- simo/core/utils/helpers.py +1 -0
- simo/core/utils/serialization.py +56 -0
- simo/core/utils/type_constants.py +1 -1
- simo/core/utils/validators.py +14 -1
- simo/core/views.py +13 -0
- simo/fleet/__pycache__/admin.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/api.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/auto_urls.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/controllers.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/forms.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/gateways.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/managers.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/models.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/serializers.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/socket_consumers.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/utils.cpython-38.pyc +0 -0
- simo/fleet/__pycache__/views.cpython-38.pyc +0 -0
- simo/fleet/admin.py +54 -25
- simo/fleet/api.py +59 -3
- simo/fleet/auto_urls.py +2 -3
- simo/fleet/controllers.py +199 -16
- simo/fleet/forms.py +325 -483
- simo/fleet/gateways.py +44 -2
- simo/fleet/managers.py +32 -0
- simo/fleet/migrations/0025_auto_20240130_1334.py +27 -0
- simo/fleet/migrations/0026_rename_i2cinterface_scl_pin_and_more.py +64 -0
- simo/fleet/migrations/0027_auto_20240306_0802.py +170 -0
- simo/fleet/migrations/0028_remove_i2cinterface_scl_pin_no_and_more.py +21 -0
- simo/fleet/migrations/0029_alter_i2cinterface_scl_pin_and_more.py +24 -0
- simo/fleet/migrations/0030_colonelpin_label_alter_colonel_type.py +24 -0
- simo/fleet/migrations/0031_alter_colonel_type.py +18 -0
- simo/fleet/migrations/__pycache__/0025_auto_20240130_1334.cpython-38.pyc +0 -0
- simo/fleet/migrations/__pycache__/0026_rename_i2cinterface_scl_pin_and_more.cpython-38.pyc +0 -0
- simo/fleet/migrations/__pycache__/0027_auto_20240306_0802.cpython-38.pyc +0 -0
- simo/fleet/migrations/__pycache__/0028_remove_i2cinterface_scl_pin_no_and_more.cpython-38.pyc +0 -0
- simo/fleet/migrations/__pycache__/0029_alter_i2cinterface_scl_pin_and_more.cpython-38.pyc +0 -0
- simo/fleet/migrations/__pycache__/0030_colonelpin_label_alter_colonel_type.cpython-38.pyc +0 -0
- simo/fleet/migrations/__pycache__/0031_alter_colonel_type.cpython-38.pyc +0 -0
- simo/fleet/models.py +134 -82
- simo/fleet/serializers.py +35 -1
- simo/fleet/socket_consumers.py +239 -76
- simo/fleet/utils.py +15 -53
- simo/fleet/views.py +28 -14
- simo/generic/controllers.py +13 -89
- simo/generic/forms.py +30 -23
- simo/generic/gateways.py +98 -10
- simo/generic/models.py +3 -3
- simo/multimedia/controllers.py +9 -8
- simo/settings.py +7 -4
- simo/urls.py +4 -8
- simo/users/__pycache__/admin.cpython-38.pyc +0 -0
- simo/users/__pycache__/api.cpython-38.pyc +0 -0
- simo/users/__pycache__/auto_urls.cpython-38.pyc +0 -0
- simo/users/__pycache__/models.cpython-38.pyc +0 -0
- simo/users/__pycache__/serializers.cpython-38.pyc +0 -0
- simo/users/__pycache__/sso_urls.cpython-38.pyc +0 -0
- simo/users/admin.py +8 -1
- simo/users/api.py +38 -2
- simo/users/auto_urls.py +2 -2
- simo/users/migrations/0025_rename_name_fingerprint_type_and_more.py +22 -0
- simo/users/migrations/__pycache__/0025_rename_name_fingerprint_type_and_more.cpython-38.pyc +0 -0
- simo/users/models.py +2 -3
- simo/users/serializers.py +15 -1
- simo/users/sso_urls.py +3 -3
- simo/wsgi.py +7 -0
- {simo-1.7.19.dist-info → simo-2.0.0.dist-info}/METADATA +8 -9
- {simo-1.7.19.dist-info → simo-2.0.0.dist-info}/RECORD +180 -210
- {simo-1.7.19.dist-info → simo-2.0.0.dist-info}/WHEEL +1 -1
- simo/core/__pycache__/__init__.cpython-37.pyc +0 -0
- simo/core/__pycache__/admin.cpython-37.pyc +0 -0
- simo/core/__pycache__/api.cpython-37.pyc +0 -0
- simo/core/__pycache__/apps.cpython-38.pyc +0 -0
- simo/core/__pycache__/controllers.cpython-37.pyc +0 -0
- simo/core/__pycache__/events.cpython-37.pyc +0 -0
- simo/core/__pycache__/forms.cpython-37.pyc +0 -0
- simo/core/__pycache__/gateways.cpython-37.pyc +0 -0
- simo/core/__pycache__/models.cpython-37.pyc +0 -0
- simo/core/__pycache__/scripts.cpython-37.pyc +0 -0
- simo/core/__pycache__/serializers.cpython-37.pyc +0 -0
- simo/core/__pycache__/widgets.cpython-37.pyc +0 -0
- simo/core/db_backend/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/db_backend/__pycache__/base.cpython-38.pyc +0 -0
- simo/core/management/commands/__pycache__/gateways_manager.cpython-38.pyc +0 -0
- simo/core/management/commands/__pycache__/run_gateway.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0001_initial.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0002_load_icons.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0003_create_default_zones_and_categories.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0004_create_generic.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0005_component_subcomponents.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0006_alter_component_subcomponents.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0007_component_change_init_to.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0008_alter_component_change_init_to.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0009_auto_20220707_1404.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0010_historyaggregate.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0011_component_last_change.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0012_instance.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0013_auto_20231003_0754.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0014_zone_instance.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0015_auto_20231004_1113.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0016_auto_20231004_1113.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0017_auto_20231004_1313.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0018_auto_20231005_0622.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0019_alter_gateway_type.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0020_component_meta.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/0021_auto_20231020_1041.cpython-38.pyc +0 -0
- simo/core/migrations/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/templatetags/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/templatetags/__pycache__/components_list.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/admin.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/config_values.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/easing.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/form_fields.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/form_widgets.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/formsets.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/helpers.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/logs.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/mixins.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/model_helpers.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/relay.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/type_constants.cpython-38.pyc +0 -0
- simo/core/utils/__pycache__/validators.cpython-38.pyc +0 -0
- simo/fleet/tasks.py +0 -25
- simo/generic/__pycache__/__init__.cpython-37.pyc +0 -0
- simo/generic/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/generic/__pycache__/app_widgets.cpython-38.pyc +0 -0
- simo/generic/__pycache__/base_types.cpython-38.pyc +0 -0
- simo/generic/__pycache__/controllers.cpython-37.pyc +0 -0
- simo/generic/__pycache__/controllers.cpython-38.pyc +0 -0
- simo/generic/__pycache__/forms.cpython-38.pyc +0 -0
- simo/generic/__pycache__/gateways.cpython-38.pyc +0 -0
- simo/generic/__pycache__/models.cpython-38.pyc +0 -0
- simo/generic/__pycache__/routing.cpython-38.pyc +0 -0
- simo/generic/__pycache__/socket_consumers.cpython-38.pyc +0 -0
- simo/generic/__pycache__/tasks.cpython-38.pyc +0 -0
- simo/generic/__pycache__/widgets.cpython-37.pyc +0 -0
- simo/generic/tasks.py +0 -41
- simo/multimedia/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/multimedia/__pycache__/admin.cpython-38.pyc +0 -0
- simo/multimedia/__pycache__/api.cpython-38.pyc +0 -0
- simo/multimedia/__pycache__/app_widgets.cpython-38.pyc +0 -0
- simo/multimedia/__pycache__/base_types.cpython-38.pyc +0 -0
- simo/multimedia/__pycache__/controllers.cpython-38.pyc +0 -0
- simo/multimedia/__pycache__/forms.cpython-38.pyc +0 -0
- simo/multimedia/__pycache__/models.cpython-38.pyc +0 -0
- simo/multimedia/__pycache__/serializers.cpython-38.pyc +0 -0
- simo/multimedia/migrations/__pycache__/0001_initial.cpython-38.pyc +0 -0
- simo/multimedia/migrations/__pycache__/0002_sound_length.cpython-38.pyc +0 -0
- simo/multimedia/migrations/__pycache__/0003_alter_sound_length.cpython-38.pyc +0 -0
- simo/multimedia/migrations/__pycache__/0004_auto_20231023_1055.cpython-38.pyc +0 -0
- simo/multimedia/migrations/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/notifications/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/notifications/__pycache__/admin.cpython-38.pyc +0 -0
- simo/notifications/__pycache__/api.cpython-38.pyc +0 -0
- simo/notifications/__pycache__/models.cpython-38.pyc +0 -0
- simo/notifications/__pycache__/serializers.cpython-38.pyc +0 -0
- simo/notifications/__pycache__/utils.cpython-38.pyc +0 -0
- simo/notifications/migrations/__pycache__/0001_initial.cpython-38.pyc +0 -0
- simo/notifications/migrations/__pycache__/0002_notification_instance.cpython-38.pyc +0 -0
- simo/notifications/migrations/__pycache__/__init__.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0001_initial.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0002_componentpermission.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0003_create_roles_and_system_user.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0004_user_secret_key.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0005_permissionsrole_instance.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0006_auto_20231003_0850.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0007_auto_20231003_1228.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0008_auto_20231003_1229.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0009_remove_user_role.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0010_auto_20231004_1313.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0011_auto_20231004_1313.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0012_alter_userinstancerole_unique_together.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0013_remove_user_roles.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0014_user_roles.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0015_remove_user_at_home.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/0016_auto_20231005_1050.cpython-38.pyc +0 -0
- simo/users/migrations/__pycache__/__init__.cpython-38.pyc +0 -0
- {simo-1.7.19.dist-info → simo-2.0.0.dist-info}/LICENSE.md +0 -0
- {simo-1.7.19.dist-info → simo-2.0.0.dist-info}/top_level.txt +0 -0
simo/users/admin.py
CHANGED
|
@@ -6,7 +6,7 @@ from django.contrib.auth.admin import UserAdmin as OrgUserAdmin
|
|
|
6
6
|
from django.contrib import admin
|
|
7
7
|
from .models import (
|
|
8
8
|
PermissionsRole, ComponentPermission, User, UserDevice, UserDeviceReportLog,
|
|
9
|
-
InstanceInvitation, InstanceUser
|
|
9
|
+
InstanceInvitation, InstanceUser, Fingerprint
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
|
|
@@ -211,4 +211,11 @@ class InstanceInvitationAdmin(admin.ModelAdmin):
|
|
|
211
211
|
"No invitations were sent."
|
|
212
212
|
)
|
|
213
213
|
|
|
214
|
+
@admin.register(Fingerprint)
|
|
215
|
+
class FingerprintAdmin(admin.ModelAdmin):
|
|
216
|
+
list_display = 'value', 'type', 'date_created', 'user',
|
|
217
|
+
search_fields = 'value', 'type', 'user__name', 'user__email'
|
|
218
|
+
readonly_fields = 'value', 'type', 'date_created'
|
|
214
219
|
|
|
220
|
+
def has_add_permission(self, request):
|
|
221
|
+
return False
|
simo/users/api.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
+
from django.db.models import Q
|
|
2
3
|
from rest_framework import viewsets, mixins, status
|
|
3
4
|
from rest_framework.serializers import Serializer
|
|
4
5
|
from rest_framework.decorators import action
|
|
@@ -9,10 +10,11 @@ from django.utils import timezone
|
|
|
9
10
|
from simo.core.api import InstanceMixin
|
|
10
11
|
from .models import (
|
|
11
12
|
User, UserDevice, UserDeviceReportLog, PermissionsRole, InstanceInvitation,
|
|
12
|
-
|
|
13
|
+
Fingerprint
|
|
13
14
|
)
|
|
14
15
|
from .serializers import (
|
|
15
|
-
UserSerializer, PermissionsRoleSerializer, InstanceInvitationSerializer
|
|
16
|
+
UserSerializer, PermissionsRoleSerializer, InstanceInvitationSerializer,
|
|
17
|
+
FingerprintSerializer
|
|
16
18
|
)
|
|
17
19
|
|
|
18
20
|
|
|
@@ -213,3 +215,37 @@ class InvitationsViewSet(InstanceMixin, viewsets.ModelViewSet):
|
|
|
213
215
|
status=400
|
|
214
216
|
)
|
|
215
217
|
return RESTResponse(response.json())
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class FingerprintViewSet(
|
|
221
|
+
InstanceMixin,
|
|
222
|
+
mixins.RetrieveModelMixin, mixins.UpdateModelMixin,
|
|
223
|
+
mixins.DestroyModelMixin, mixins.ListModelMixin,
|
|
224
|
+
viewsets.GenericViewSet
|
|
225
|
+
):
|
|
226
|
+
url = 'users/fingerprints'
|
|
227
|
+
basename = 'fingerprints'
|
|
228
|
+
serializer_class = FingerprintSerializer
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def get_queryset(self):
|
|
232
|
+
return Fingerprint.objects.filter(
|
|
233
|
+
Q(user=None) | Q(user__roles__instance=self.instance)
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
def check_can_manage_user(self, request):
|
|
237
|
+
user_role = request.user.get_role(self.instance)
|
|
238
|
+
if not request.user.is_superuser:
|
|
239
|
+
if not user_role or not user_role.can_manage_users:
|
|
240
|
+
msg = 'You are not allowed to change this!'
|
|
241
|
+
print(msg, file=sys.stderr)
|
|
242
|
+
raise ValidationError(msg, code=403)
|
|
243
|
+
|
|
244
|
+
def update(self, request, *args, **kwargs):
|
|
245
|
+
self.check_can_manage_user(request)
|
|
246
|
+
return super().update(request, *args, **kwargs)
|
|
247
|
+
|
|
248
|
+
def destroy(self, request, *args, **kwargs):
|
|
249
|
+
self.check_can_manage_user(request)
|
|
250
|
+
return super().destroy(request, *args, **kwargs)
|
|
251
|
+
|
simo/users/auto_urls.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
from django.
|
|
1
|
+
from django.urls import include, re_path
|
|
2
2
|
from django.views.generic import TemplateView
|
|
3
3
|
from .views import accept_invitation
|
|
4
4
|
|
|
5
5
|
urlpatterns = [
|
|
6
|
-
|
|
6
|
+
re_path(
|
|
7
7
|
r"^accept-invitation/(?P<token>[a-zA-Z0-9]+)/$",
|
|
8
8
|
accept_invitation, name='accept_invitation'
|
|
9
9
|
),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Generated by Django 4.2.10 on 2024-03-22 11:30
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('users', '0024_fingerprint'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.RenameField(
|
|
14
|
+
model_name='fingerprint',
|
|
15
|
+
old_name='name',
|
|
16
|
+
new_name='type',
|
|
17
|
+
),
|
|
18
|
+
migrations.RemoveField(
|
|
19
|
+
model_name='fingerprint',
|
|
20
|
+
name='is_valid',
|
|
21
|
+
),
|
|
22
|
+
]
|
|
Binary file
|
simo/users/models.py
CHANGED
|
@@ -360,8 +360,7 @@ class Fingerprint(models.Model):
|
|
|
360
360
|
related_name='fingerprints'
|
|
361
361
|
)
|
|
362
362
|
date_created = models.DateTimeField(auto_now_add=True)
|
|
363
|
-
|
|
364
|
-
is_valid = models.BooleanField(default=True, db_index=True)
|
|
363
|
+
type = models.CharField(max_length=100, null=True, blank=True)
|
|
365
364
|
|
|
366
365
|
|
|
367
366
|
class UserDevice(models.Model, SimoAdminMixin):
|
|
@@ -463,7 +462,7 @@ class ComponentPermission(models.Model):
|
|
|
463
462
|
|
|
464
463
|
|
|
465
464
|
@receiver(post_save, sender=ComponentPermission)
|
|
466
|
-
def
|
|
465
|
+
def rebuild_mqtt_acls_on_create(sender, instance, created, **kwargs):
|
|
467
466
|
if not created:
|
|
468
467
|
rebuild_mqtt_acls.delay()
|
|
469
468
|
|
simo/users/serializers.py
CHANGED
|
@@ -2,7 +2,9 @@ from rest_framework import serializers
|
|
|
2
2
|
from collections.abc import Iterable
|
|
3
3
|
from simo.core.middleware import get_current_request
|
|
4
4
|
from simo.core.utils.api import ReadWriteSerializerMethodField
|
|
5
|
-
from .models import
|
|
5
|
+
from .models import (
|
|
6
|
+
User, PermissionsRole, InstanceInvitation, InstanceUser, Fingerprint
|
|
7
|
+
)
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
|
|
@@ -72,3 +74,15 @@ class InstanceInvitationSerializer(serializers.ModelSerializer):
|
|
|
72
74
|
read_only_fields = (
|
|
73
75
|
'instance', 'token', 'from_user', 'taken_by',
|
|
74
76
|
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class FingerprintSerializer(serializers.ModelSerializer):
|
|
80
|
+
type = serializers.SerializerMethodField()
|
|
81
|
+
|
|
82
|
+
class Meta:
|
|
83
|
+
model = Fingerprint
|
|
84
|
+
fields = 'type', 'value', 'user'
|
|
85
|
+
read_only_fields = ('type', 'value')
|
|
86
|
+
|
|
87
|
+
def get_type(self, obj):
|
|
88
|
+
return obj.type
|
simo/users/sso_urls.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from django.
|
|
1
|
+
from django.urls import re_path
|
|
2
2
|
from .sso_views import LoginView, AuthenticateView
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
urlpatterns = [
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
re_path(r'^$', LoginView.as_view(), name='login'),
|
|
7
|
+
re_path(r'^authenticate/$', AuthenticateView.as_view(), name='simple-sso-authenticate'),
|
|
8
8
|
]
|
simo/wsgi.py
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: simo
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Smart Home on Steroids!
|
|
5
5
|
Author-email: Simanas Venčkauskas <simanas@simo.io>
|
|
6
6
|
Project-URL: Homepage, https://simo.io
|
|
@@ -11,18 +11,17 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.8
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE.md
|
|
14
|
-
Requires-Dist: Django ==
|
|
15
|
-
Requires-Dist: django-
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist: djangorestframework ==3.12.4
|
|
14
|
+
Requires-Dist: Django ==4.2.10
|
|
15
|
+
Requires-Dist: django-autocomplete-light ==3.11.0
|
|
16
|
+
Requires-Dist: djangorestframework ==3.14.0
|
|
18
17
|
Requires-Dist: django-dynamic-preferences ==1.11.0
|
|
19
18
|
Requires-Dist: django-formtools ==2.3
|
|
20
|
-
Requires-Dist: easy-thumbnails ==2.8
|
|
21
|
-
Requires-Dist: channels ==
|
|
22
|
-
Requires-Dist: asgiref ==3.
|
|
19
|
+
Requires-Dist: easy-thumbnails ==2.8.5
|
|
20
|
+
Requires-Dist: channels ==4.0.0
|
|
21
|
+
Requires-Dist: asgiref ==3.7.2
|
|
23
22
|
Requires-Dist: django-filter ==2.4.0
|
|
24
23
|
Requires-Dist: celery ==5.3.6
|
|
25
|
-
Requires-Dist: django-admin-sortable2 ==1.
|
|
24
|
+
Requires-Dist: django-admin-sortable2 ==2.1.10
|
|
26
25
|
Requires-Dist: django-bootstrap4 ==3.0.1
|
|
27
26
|
Requires-Dist: psycopg2 ==2.9.2
|
|
28
27
|
Requires-Dist: django-model-utils ==4.2.0
|