django-restit 4.2.88__py3-none-any.whl → 4.2.90__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/rpc/group.py CHANGED
@@ -110,5 +110,20 @@ def rest_on_member_feed(request, pk=None):
110
110
  @rd.urlGET('group/stats/kinds')
111
111
  @rd.login_required
112
112
  def rest_on_group_stats(request):
113
- out = rh.countOccurences(Group.objects.filter(is_active=True), "kind")
113
+ params = request.DATA.asDict()
114
+ if not params.group:
115
+ if not request.member.hasPerm(["view_all_groups", "manage_groups"]):
116
+ return rv.restPermissionDenied()
117
+ out = rh.countOccurences(Group.objects.filter(is_active=True), "kind")
118
+ return rv.restResult(request, dict(data=out))
119
+ # local
120
+ group = Group.objects.filter(pk=params.group).first()
121
+ if not group:
122
+ return rv.restPermissionDenied(request)
123
+ if not request.member.hasPerm(["view_all_groups", "manage_groups"]):
124
+ if not request.member.hasGroupPerm(group, ["reports", "reporting"]):
125
+ return rv.restPermissionDenied(request)
126
+ qset = group.getAllChildren(True, True, True).filter(is_active=True)
127
+ out = rh.countOccurences(qset, "kind")
114
128
  return rv.restResult(request, dict(data=out))
129
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.2.88
3
+ Version: 4.2.90
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -42,7 +42,7 @@ account/periodic.py,sha256=-u0n-7QTJgDOkasGhBAPwHAwjpqWGA-MZLEFkVTqCGU,874
42
42
  account/rpc/__init__.py,sha256=SGF0M_-H0dKh3b1apSX29BotNWAvITYccGQVC0MIjL8,336
43
43
  account/rpc/auth.py,sha256=p62tyihWvSY2zn7eaVxKcCG9qLnnZBIkwdRH81sS5_Y,16615
44
44
  account/rpc/device.py,sha256=mB14a6qvJIBnCa9ivLhPXwEt5Gk2foyqsKBtZxC506k,3070
45
- account/rpc/group.py,sha256=Iiefop0XmnuTZtZJTSyXbIAa7jD1cRLfreHMZWdhteE,4230
45
+ account/rpc/group.py,sha256=riymUK6ttv8G6SG6K-v7UCvM40WQy3HaGSeF_sEiaU0,4929
46
46
  account/rpc/member.py,sha256=VNRSD38mmTUCbq3cCSy3qRyquzeVEwW_8zzrtS0-vAA,1817
47
47
  account/rpc/notify.py,sha256=Q2YWejP36egeF060Hih5uX4Psv_B8NWlLLPi7iDYlIw,3344
48
48
  account/rpc/oauth.py,sha256=ISLVsR5HvKALANokaOFRvF4FTRxWtXPvVnZAYANKxpo,2864
@@ -112,7 +112,7 @@ incident/migrations/0015_rule_title_template_alter_incident_state.py,sha256=FPUD
112
112
  incident/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
113
  incident/models/__init__.py,sha256=NMphuhb0RTMf7Ov4QkNv7iv6_I8Wtr3xQ54yjX_a31M,209
114
114
  incident/models/event.py,sha256=Dw6fUi2tbLeA_ZRDcvGQNFkCkMGMBdtNeaLikXdAyE8,7769
115
- incident/models/incident.py,sha256=uKF7fUjZUPjLlfpRIlFMocGaanng2wmHmglP5RAzv_w,19847
115
+ incident/models/incident.py,sha256=1uLkr7_QEKYsccO-OVmb7YcM8BA3Q6UCWWw2m935YKg,20030
116
116
  incident/models/ossec.py,sha256=eUDRGawzuLWobKEVGKfdZisDnyjS_Hlxi0T_GCSLCCI,2252
117
117
  incident/models/rules.py,sha256=aRkJ0ZnTv87nAUC1sHVkPExfb3OJ8fgHQIhnCIpIbhQ,7001
118
118
  incident/models/ticket.py,sha256=S3kqGQpYLE6Y4M9IKu_60sgW-f592xNr8uufqHnvDoU,2302
@@ -406,7 +406,7 @@ rest/middleware/session_store.py,sha256=1nSdeXK8PyuYgGgIufqrS6j6QpIrQ7zbMNT0ol75
406
406
  rest/models/__init__.py,sha256=M8pvFDq-WCF-QcM58X7pMufYYe0aaQ3U0PwGe9TKbbY,130
407
407
  rest/models/base.py,sha256=bPcTeCX7KvhkcVMKEyLmu9eYc7ccJGkIP1n3cctJPVE,69675
408
408
  rest/models/cacher.py,sha256=eKz8TINVhWEqKhJGMsRkKZTtBUIv5rN3NHbZwOC56Uk,578
409
- rest/models/metadata.py,sha256=65GvfFbc26_7wJz8qEAzU7fEOZWVz0ttO5j5m_gs4hk,12860
409
+ rest/models/metadata.py,sha256=1nQ7CYo9bJHoaXE_hVNaj1-Y7yqhHlf2ZlaD1IfTzic,12904
410
410
  rest/net.py,sha256=LcB2QV6VNRtsSdmiQvYZgwQUDwOPMn_VBdRiZ6OpI-I,2974
411
411
  rest/regexes.yaml,sha256=VoGb4E-P_K9f82Yzcpltgzekpt9usRtwu9PYlo46nUw,149463
412
412
  rest/requestex.py,sha256=N56056vV3zWkAP-QrYsCu7SdpPzE5kLuPoxGIuZAKt0,16127
@@ -506,7 +506,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
506
506
  ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
507
507
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
508
508
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
509
- django_restit-4.2.88.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
510
- django_restit-4.2.88.dist-info/METADATA,sha256=kNtJO38wHtEHLW03kxVgMPBEsRgcgLr8-jwlHYwMwUc,7645
511
- django_restit-4.2.88.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
512
- django_restit-4.2.88.dist-info/RECORD,,
509
+ django_restit-4.2.90.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
510
+ django_restit-4.2.90.dist-info/METADATA,sha256=NgUxbFxdTPM54mt7gxCFK77X4SIu0_2TDlioDkYvgC8,7645
511
+ django_restit-4.2.90.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
512
+ django_restit-4.2.90.dist-info/RECORD,,
@@ -151,6 +151,10 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
151
151
  self.setProperty("state", event.metadata.geoip.state)
152
152
  self.setProperty("country", event.metadata.geoip.country)
153
153
  self.setProperty("isp", event.metadata.geoip.isp)
154
+ else:
155
+ for key in ["city", "state", "country", "isp"]:
156
+ if key in event.metadata:
157
+ self.setProperty(new_key, event.metadata[key])
154
158
 
155
159
  def shouldTriggerAction(self):
156
160
  count = self.events.all().count()
rest/models/metadata.py CHANGED
@@ -115,7 +115,7 @@ class MetaDataModel(object):
115
115
  if not isinstance(values, dict):
116
116
  raise Exception("invalid metadata: {}".format(values))
117
117
 
118
- for key, value in list(values.items()):
118
+ for key, value in values.items():
119
119
  cat = None
120
120
  if "." in key:
121
121
  cat, key = key.split('.')
@@ -230,15 +230,17 @@ class MetaDataModel(object):
230
230
  request = rh.getActiveRequest()
231
231
  self.__initFieldProps()
232
232
 
233
+ if "." in key:
234
+ category, key = key.split('.')
235
+
233
236
  if isinstance(value, dict):
234
- return self.setProperties(value, key)
237
+ if category is None:
238
+ return self.setProperties(value, key)
235
239
  username = "root"
236
240
  if request and request.member:
237
241
  username = request.member.username
238
242
  prop = None
239
243
 
240
- if "." in key:
241
- category, key = key.split('.')
242
244
  if category:
243
245
  # delete any keys with this category name
244
246
  full_key = "{}.{}".format(category, key)