django-restit 4.1.73__py3-none-any.whl → 4.1.75__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.
- account/models/member.py +4 -0
- auditlog/models.py +2 -0
- {django_restit-4.1.73.dist-info → django_restit-4.1.75.dist-info}/METADATA +1 -1
- {django_restit-4.1.73.dist-info → django_restit-4.1.75.dist-info}/RECORD +10 -10
- incident/models/incident.py +10 -5
- rest/__init__.py +1 -1
- telephony/models.py +6 -1
- telephony/phone_util.py +9 -0
- {django_restit-4.1.73.dist-info → django_restit-4.1.75.dist-info}/LICENSE.md +0 -0
- {django_restit-4.1.73.dist-info → django_restit-4.1.75.dist-info}/WHEEL +0 -0
account/models/member.py
CHANGED
@@ -82,9 +82,13 @@ class Member(User, RestModel, MetaDataModel):
|
|
82
82
|
"first_name", "last_name",
|
83
83
|
"last_activity#datetime", "date_joined#datetime",
|
84
84
|
"is_staff",
|
85
|
+
("ip", "auth_sessions__ip"),
|
85
86
|
("notify_via", "properties|notify_via"),
|
86
87
|
("phone", "phone_number"),
|
87
88
|
("perms", "properties|permissions.")]
|
89
|
+
QUERY_FIELDS_SPECIAL = {
|
90
|
+
"ip": "auth_sessions__ip",
|
91
|
+
}
|
88
92
|
UNIQUE_LOOKUP = ["username", "email"]
|
89
93
|
METADATA_FIELD_PROPERTIES = settings.USER_METADATA_PROPERTIES
|
90
94
|
GRAPHS = {
|
auditlog/models.py
CHANGED
@@ -22,7 +22,7 @@ account/models/device.py,sha256=XipNpByreGubB5-d4ZBOoIV5Xw14b2Btcgn6fXz8HAc,4105
|
|
22
22
|
account/models/feeds.py,sha256=4n4Mv8HjcXpUmMPWafHlsGbVQ1fDKdtblL1hp30sDrg,1437
|
23
23
|
account/models/group.py,sha256=X_ij8moxmtH9qwH3w2EL8siuy-prsyxQVv1JIhBp3hI,19399
|
24
24
|
account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
|
25
|
-
account/models/member.py,sha256=
|
25
|
+
account/models/member.py,sha256=kyPnmRRG-LF9q9bOfmaGkuPHnePu8bR7wKfhlqy6Xoo,48477
|
26
26
|
account/models/membership.py,sha256=l7suW6kRCfa3KqdbqjOIO2jVhxjkPbEENdJIlj2WomY,7378
|
27
27
|
account/models/notify.py,sha256=YnZujSHJHY7B09e6FIyZIEJRWLPYk1Sk1e92tFzB1IA,12078
|
28
28
|
account/models/session.py,sha256=swhxcx_lWzOpGCmfifXoACgWYqmKmS7eZsD9s9jSToc,3509
|
@@ -54,7 +54,7 @@ auditlog/decorators.py,sha256=ZoIv0fhZjxtMEV15NcKijW4xPF5UEScPna60zB3TxZo,6553
|
|
54
54
|
auditlog/middleware.py,sha256=GtfFR90uLltiLsAx8t4xeid5QssqcusbrKjgBl08kuw,1329
|
55
55
|
auditlog/migrations/0001_initial.py,sha256=X171gKQZIaTO9FGNG1yKTjGSZS0ZjZj5gvimF9-_kks,3309
|
56
56
|
auditlog/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
|
-
auditlog/models.py,sha256=
|
57
|
+
auditlog/models.py,sha256=6CyWMRNvqCYoyiXE9_qk41EJFjutwo6nfoP9KKYWiYw,16294
|
58
58
|
auditlog/periodic.py,sha256=AUhDeVsZtC47BJ-lklvYEegHoxAzj1RpIvRFSsM7g5E,363
|
59
59
|
auditlog/rpc.py,sha256=w01zcOiqmqM0953Muq9I4OY7o0CyKmwDEQTV4LfsASs,3591
|
60
60
|
auditlog/tq.py,sha256=OgzJVspWI6FL92GEhDPtabYoP_Hd3zGNh0E297abz3Y,2415
|
@@ -94,7 +94,7 @@ incident/migrations/0011_ticket.py,sha256=Ml5E_Qi4Z0MD89fetoOFOL3rPlVQdjaaDCcFBf
|
|
94
94
|
incident/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
95
95
|
incident/models/__init__.py,sha256=NMphuhb0RTMf7Ov4QkNv7iv6_I8Wtr3xQ54yjX_a31M,209
|
96
96
|
incident/models/event.py,sha256=AXFV92OtnVi3opSZcRX1o3qZ8uBvqGFL549AXH2gjY8,6792
|
97
|
-
incident/models/incident.py,sha256=
|
97
|
+
incident/models/incident.py,sha256=qBwXC4lhQ8YZ7EatDjOced93cXq1jJqYgElgmKfl9nw,14409
|
98
98
|
incident/models/ossec.py,sha256=pWMqcuTRxPFTEF-OZQSMn7YpNEE9mfsI4GMhWWjJs5I,2187
|
99
99
|
incident/models/rules.py,sha256=Ua-hC78_D6YikJjP3DXfA8ghi6zu__Qud8H1bk7MRG0,5342
|
100
100
|
incident/models/ticket.py,sha256=S3kqGQpYLE6Y4M9IKu_60sgW-f592xNr8uufqHnvDoU,2302
|
@@ -350,7 +350,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
350
350
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
351
351
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
352
352
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
353
|
-
rest/__init__.py,sha256=
|
353
|
+
rest/__init__.py,sha256=EBklYrW3BC8Q1_xwHhntKj0NjkG0lEqi8Nw56aKm-K0,121
|
354
354
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
355
355
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
356
356
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -447,8 +447,8 @@ telephony/decorators.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
447
447
|
telephony/migrations/0001_initial.py,sha256=YRiNtpeqj-4uvq19sfI64Q-KRnQ_T53kNzyt-CZUl14,3030
|
448
448
|
telephony/migrations/0002_alter_sms_sid.py,sha256=QAnMG-UZ5emssZwdJ8XwfaRh3872zUUR55maDMD4RkE,424
|
449
449
|
telephony/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
450
|
-
telephony/models.py,sha256=
|
451
|
-
telephony/phone_util.py,sha256=
|
450
|
+
telephony/models.py,sha256=S6k7rbG1GxO9nhffOOzbM-jgpm1PJEfO20mdj6IIpDI,8116
|
451
|
+
telephony/phone_util.py,sha256=15IWkTSqkjDWT9edPAYogAxHc1OdjOziPSxsJ8vfpfE,2426
|
452
452
|
telephony/rpc.py,sha256=GVPWH5XSPNar-ICu5oq-yF6FBmJbju3XJr6gSXA6ZVU,3535
|
453
453
|
wiki/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
454
454
|
wiki/migrations/0001_initial.py,sha256=9jvUyjrbJrbDilRnwzQUPhPV8Xi_olEPBk_N0nycvM0,3606
|
@@ -482,7 +482,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
482
482
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
483
483
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
484
484
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
485
|
-
django_restit-4.1.
|
486
|
-
django_restit-4.1.
|
487
|
-
django_restit-4.1.
|
488
|
-
django_restit-4.1.
|
485
|
+
django_restit-4.1.75.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
486
|
+
django_restit-4.1.75.dist-info/METADATA,sha256=hjRHe-VVVIQu1Sqhc6pz00FdyeLdszibBJ-5coivs7I,7573
|
487
|
+
django_restit-4.1.75.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
488
|
+
django_restit-4.1.75.dist-info/RECORD,,
|
incident/models/incident.py
CHANGED
@@ -164,11 +164,16 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
|
|
164
164
|
# sms:NOTIFY_SETTING
|
165
165
|
self.action_sent = datetime.now()
|
166
166
|
self.save()
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
167
|
+
try:
|
168
|
+
action, perm = self.rule.action.split(":")
|
169
|
+
members = Member.GetWithNotification(perm)
|
170
|
+
# count = self.getProperty("event_count", default=1, field_type=int)
|
171
|
+
url = F"{settings.INCIDENT_PORTAL_URL}"
|
172
|
+
msg = f"Incident #{self.pk}\n{self.description}\n<a href='{url}?incident={self.pk}'>view</a>"
|
173
|
+
for m in members:
|
174
|
+
m.sendSMS(msg)
|
175
|
+
except Exception:
|
176
|
+
rh.log_exception("triggerSMS")
|
172
177
|
|
173
178
|
def notifyWith(self, perm):
|
174
179
|
# logger.info("notifyWith", perm)
|
rest/__init__.py
CHANGED
telephony/models.py
CHANGED
@@ -157,7 +157,12 @@ class SMS(models.Model, RestModel):
|
|
157
157
|
msg.reason = "number valid: {} number kind: {} cannot receive sms".format(to_info.is_valid, to_info.kind)
|
158
158
|
msg.save()
|
159
159
|
return msg
|
160
|
-
|
160
|
+
if transport == "sms":
|
161
|
+
resp = phone_util.sendSMS(endpoint, srcpoint, message)
|
162
|
+
elif transport == "whatsapp":
|
163
|
+
resp = phone_util.sendWhatsApp(endpoint, srcpoint, message)
|
164
|
+
else:
|
165
|
+
raise Exception(f"unknown transport: {transport}")
|
161
166
|
msg = SMS(endpoint=endpoint, message=message, srcpoint=srcpoint, transport=transport, by=by, to=to, group=group)
|
162
167
|
msg.sid = resp.sid
|
163
168
|
msg.status = resp.status
|
telephony/phone_util.py
CHANGED
@@ -38,6 +38,15 @@ def sendSMS(to_num, from_num, msg, country="US"):
|
|
38
38
|
return tmsg
|
39
39
|
|
40
40
|
|
41
|
+
def sendWhatsApp(to_num, from_num, msg, country="US"):
|
42
|
+
to_num = normalize(to_num, country)
|
43
|
+
to_num = f"whatsapp:{to_num}"
|
44
|
+
from_num = normalize(from_num, country)
|
45
|
+
from_num = f"whatsapp:{from_num}"
|
46
|
+
tmsg = client.messages.create(body=msg, to=to_num, from_=from_num)
|
47
|
+
return tmsg
|
48
|
+
|
49
|
+
|
41
50
|
def find(text, country="US"):
|
42
51
|
# finds any phone numbers in the text blob
|
43
52
|
numbers = []
|
File without changes
|
File without changes
|