django-restit 4.2.88__py3-none-any.whl → 4.2.89__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"]):
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.89
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=Bs9O69xHXtFT-fykPXPzRtLI9C0Oj967N2hJklv3wZ4,4916
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
@@ -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.89.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
510
+ django_restit-4.2.89.dist-info/METADATA,sha256=oUQ-GYEwBbLeQLyb9if2FDKwacmHQN7cLrFtJFsdD80,7645
511
+ django_restit-4.2.89.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
512
+ django_restit-4.2.89.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()