commonground-api-common 1.13.0__py3-none-any.whl → 1.13.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: commonground-api-common
3
- Version: 1.13.0
3
+ Version: 1.13.2
4
4
  Summary: Commonground API tooling
5
5
  Home-page: https://github.com/maykinmedia/commonground-api-common
6
6
  Author: Maykin Media, VNG-Realisatie
@@ -1,7 +1,7 @@
1
- commonground_api_common-1.13.0.data/scripts/generate_schema,sha256=UKhznmbHX1zUjPx8G3XtxUPQiqnyd3TOIXs27Tnjl7U,952
2
- commonground_api_common-1.13.0.data/scripts/patch_content_types,sha256=dpGpYrZOZe8O5CHWd0F0QnP6Wk_7lK6DyuVZpBPr4mY,319
3
- commonground_api_common-1.13.0.data/scripts/use_external_components,sha256=xvvbngO2aDUagVXv4xRUqPaVtH_eOaVMWLQ8lyAPhEA,369
4
- vng_api_common/__init__.py,sha256=qyRV1Az4m5yhA_Nx1r_oZmIwZAZJpLTJdDw9oDJaqr8,23
1
+ commonground_api_common-1.13.2.data/scripts/generate_schema,sha256=UKhznmbHX1zUjPx8G3XtxUPQiqnyd3TOIXs27Tnjl7U,952
2
+ commonground_api_common-1.13.2.data/scripts/patch_content_types,sha256=dpGpYrZOZe8O5CHWd0F0QnP6Wk_7lK6DyuVZpBPr4mY,319
3
+ commonground_api_common-1.13.2.data/scripts/use_external_components,sha256=xvvbngO2aDUagVXv4xRUqPaVtH_eOaVMWLQ8lyAPhEA,369
4
+ vng_api_common/__init__.py,sha256=e1i4EXbzZ1xnh8stGo52300k0WTGVZuco7l8x2OgNso,23
5
5
  vng_api_common/admin.py,sha256=oWKpUl5yjeYOIsh60ruCmBDyPURGq4ALle4zGhlUQsE,902
6
6
  vng_api_common/apps.py,sha256=wOQuxUImMpH39R0JrDdCZp5ADaUM8jU8vFPFW9froSs,3458
7
7
  vng_api_common/checks.py,sha256=tOyfV7MMLGh4anrd_W30LvJCxiyQ4sFs1mGd9mtrEc0,1175
@@ -21,7 +21,7 @@ vng_api_common/generators.py,sha256=tD7ZyyFgCQ3KiktpBFtn5YiVdl3jioGxzyvkEZFYdQQ,
21
21
  vng_api_common/geo.py,sha256=AZbrw0rwGYOmaSUk8JJSkx-4_tVrfT_cgggh9omRwhU,1862
22
22
  vng_api_common/middleware.py,sha256=DhdGA_9_bk7bYr-keHEt4F_VS6IkYJmzzAhkjqnzeYw,8857
23
23
  vng_api_common/mocks.py,sha256=JjpJyVmHReRUXbwDi2cnmuq4NYI1hLRr_W962TIhN6Y,6118
24
- vng_api_common/models.py,sha256=XXNpoOjSuA_9Ep2hIAm3jEELj6i66QFWHqdJbt5v4do,4810
24
+ vng_api_common/models.py,sha256=JmUfkM1PuiqW3wuTA-chMtcDGvohy4j0JsB95s7VK4Q,5041
25
25
  vng_api_common/oas.py,sha256=FiqBZ3n36q-fPRZEgpmLDxjnqmoAKmaTKZ-FlFcuRp0,2712
26
26
  vng_api_common/permissions.py,sha256=ayDxk9Wt8j0yO57FhZ8XaRkPET4lAqd8SSw3m4o3EGs,7562
27
27
  vng_api_common/polymorphism.py,sha256=N-x39pG2unD4N0ZbxFvuhE8ibPaJ0eKeqfvAJW3NnEU,6623
@@ -32,7 +32,7 @@ vng_api_common/search.py,sha256=yehS6boCOk1JXLCqAMU-B62hWtbTBSf_WKIVGPgp0Mg,1045
32
32
  vng_api_common/serializers.py,sha256=7_7IotlRfVb0woe6Wy79l_el3sPzrSY8-bfiYLbEUqs,10162
33
33
  vng_api_common/urls.py,sha256=9IWHYLlEIIHNaZ_Zq02qNQ2HJpETb7o-89r7yBM_tQs,270
34
34
  vng_api_common/utils.py,sha256=CFmG4xVabUA4GcWiOEbGSaL5mdFi8njsspTXRl8yjCY,9057
35
- vng_api_common/validators.py,sha256=T93C2rdNA4vFBi33mGlE2Cb5cQZaMPTsMvcFRz3igYU,12009
35
+ vng_api_common/validators.py,sha256=iYtOZs9Lqm4FDZ0PMfT44wxqlHN58RRd42Bv46iNn0I,12164
36
36
  vng_api_common/version.py,sha256=yJV9_yTM7Qnzg0zGNkJQkN9Uai3I_ZUkcyseJRPRk5I,129
37
37
  vng_api_common/views.py,sha256=2fraDBtq9x2hMauRuOKkn6cDUw0IYdzfPKTxFFRRFXk,7309
38
38
  vng_api_common/viewsets.py,sha256=z5pzvSymFiiuCjP_-uuW-3OJKZY_psPAt8fWeWySU0c,2278
@@ -75,7 +75,7 @@ vng_api_common/audittrails/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
75
75
  vng_api_common/audittrails/migrations/_operations.py,sha256=UOMv0zAK8CIQ73cSu6wwQG_hkW46Isdy7JCnljn8GII,3280
76
76
  vng_api_common/authorizations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  vng_api_common/authorizations/admin.py,sha256=BmJQgNH7KlDB3flAXrSMm_w0NowpJrDYWDY61RZcKCI,795
78
- vng_api_common/authorizations/models.py,sha256=n1hJci5dQQ_TmcPTAD34QVrBoHR9_z-hloQ0VXi2bzI,3657
78
+ vng_api_common/authorizations/models.py,sha256=ahwEMG5R6ILTlrnKo5TggYp52Z7dAJMk2QSZyZW8Qa0,4236
79
79
  vng_api_common/authorizations/serializers.py,sha256=3HeKWEqhI3UWwI8SttC4rEID-Epbk7SWsC-bEjolbaw,5151
80
80
  vng_api_common/authorizations/validators.py,sha256=u7fKm0QgGy8fiAeYmIEB9Gy-yIE9C-tC2ZpnNQBXPso,2816
81
81
  vng_api_common/authorizations/migrations/0001_initial.py,sha256=ooAZtQeDtWgDxXzAP-KnSyyFYLRPM-PMrK5RgOnTPjQ,4360
@@ -136,7 +136,7 @@ vng_api_common/notifications/handlers.py,sha256=-r52nIKbHdFUxE7hob9PiFRe0D3cizhk
136
136
  vng_api_common/notifications/models.py,sha256=Ez3JYeM7BNSiFYtxAtVxWUWDc8t7jOFQlRTjrtE6SlI,2942
137
137
  vng_api_common/notifications/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
138
138
  vng_api_common/notifications/api/urls.py,sha256=c1T_6tuRpgN0V80Xg_ehZzGGlF1FNMmHdBEPAjR736I,164
139
- vng_api_common/notifications/api/views.py,sha256=nUqqAANsxzWx5zDbW0Mbi5CONRdeAirvPrwjSXiP6ao,2312
139
+ vng_api_common/notifications/api/views.py,sha256=8LMh4XU_qCQURx7BLn6HnaFt1auUXlF7PHlOrcJSZ0w,2303
140
140
  vng_api_common/notifications/migrations/0001_initial.py,sha256=zEIVIB--6FStaTl3r9GCXxHL1cSCWRO3T90rEpJr3hY,3049
141
141
  vng_api_common/notifications/migrations/0002_subscription__subscription.py,sha256=eqaj6-FAl7vuCswdvin9Lf8nzjP8U6WqVQO4opNKKCc,550
142
142
  vng_api_common/notifications/migrations/0003_auto_20190319_1048.py,sha256=C-ccYUwQPNCjTctpDDFhnQbm_OcpAlTjYQbEuiEi-ys,987
@@ -187,7 +187,7 @@ vng_api_common/tests/auth.py,sha256=IKDWTEFv4Bign4F70-ibsFcnJqRxEJaXvqaPQJWa1xY,
187
187
  vng_api_common/tests/caching.py,sha256=zfIw5cRRvO9cekHZZKfRqZc8cx5IfJUYNmcH6cuIMg4,624
188
188
  vng_api_common/tests/schema.py,sha256=9LFgEXzcYGkHZtlpCiHNCWywR5lF7Pl0S43cwlwKDgQ,1954
189
189
  vng_api_common/tests/urls.py,sha256=PFrYzQbBC0TFPMEn3uPhcBG0IQs9JsEPqckicJT1UA4,2159
190
- commonground_api_common-1.13.0.dist-info/METADATA,sha256=0VY1-6hGQCu0ynbXF9Q_PCZBNrJcPopNgNlvDrzjr54,6656
191
- commonground_api_common-1.13.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
192
- commonground_api_common-1.13.0.dist-info/top_level.txt,sha256=vPismc83zPzWXTmlNCCwfDlFV9iygJYxNJW5iDjKTgw,15
193
- commonground_api_common-1.13.0.dist-info/RECORD,,
190
+ commonground_api_common-1.13.2.dist-info/METADATA,sha256=suvblBi_2_joSevlo67TVW8tzQIEfvkiaPl2qC0Q1gM,6656
191
+ commonground_api_common-1.13.2.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
192
+ commonground_api_common-1.13.2.dist-info/top_level.txt,sha256=vPismc83zPzWXTmlNCCwfDlFV9iygJYxNJW5iDjKTgw,15
193
+ commonground_api_common-1.13.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: setuptools (70.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1 +1 @@
1
- __version__ = "1.13.0"
1
+ __version__ = "1.13.2"
@@ -23,6 +23,11 @@ class AuthorizationsConfig(ClientConfig):
23
23
  verbose_name = _("Autorisatiecomponentconfiguratie")
24
24
 
25
25
 
26
+ class ApplicatieManager(models.Manager):
27
+ def get_by_natural_key(self, uuid):
28
+ return self.get(uuid=uuid)
29
+
30
+
26
31
  class Applicatie(APIMixin, models.Model):
27
32
  """
28
33
  Client level of authorization
@@ -52,10 +57,20 @@ class Applicatie(APIMixin, models.Model):
52
57
  ),
53
58
  )
54
59
 
60
+ objects = ApplicatieManager()
61
+
62
+ def natural_key(self):
63
+ return (str(self.uuid),)
64
+
55
65
  def __str__(self):
56
66
  return f"Applicatie ({self.label})"
57
67
 
58
68
 
69
+ class AutorisatieManager(models.Manager):
70
+ def get_by_natural_key(self, applicatie, component, scopes):
71
+ return self.get(applicatie=applicatie, component=component, scopes=scopes)
72
+
73
+
59
74
  class Autorisatie(APIMixin, models.Model):
60
75
  applicatie = models.ForeignKey(
61
76
  "Applicatie",
@@ -109,6 +124,15 @@ class Autorisatie(APIMixin, models.Model):
109
124
  blank=True,
110
125
  )
111
126
 
127
+ objects = AutorisatieManager()
128
+
129
+ def natural_key(self):
130
+ return (
131
+ self.applicatie,
132
+ self.component,
133
+ self.scopes,
134
+ )
135
+
112
136
  def satisfy_vertrouwelijkheid(self, vertrouwelijkheidaanduiding: str) -> bool:
113
137
  max_confid_level = VertrouwelijkheidsAanduiding.get_choice(
114
138
  self.max_vertrouwelijkheidaanduiding
vng_api_common/models.py CHANGED
@@ -34,6 +34,11 @@ class APIMixin:
34
34
  return url
35
35
 
36
36
 
37
+ class JWTSecretManager(models.Manager):
38
+ def get_by_natural_key(self, identifier):
39
+ return self.get(identifier=identifier)
40
+
41
+
37
42
  class JWTSecret(models.Model):
38
43
  """
39
44
  Store credentials of clients that want to access our API.
@@ -53,6 +58,11 @@ class JWTSecret(models.Model):
53
58
  _("secret"), max_length=255, help_text=_("Secret belonging to the client ID.")
54
59
  )
55
60
 
61
+ objects = JWTSecretManager()
62
+
63
+ def natural_key(self):
64
+ return (self.identifier,)
65
+
56
66
  class Meta:
57
67
  verbose_name = _("client credential")
58
68
  verbose_name_plural = _("client credentials")
@@ -21,9 +21,7 @@ class NotificationBaseView(APIView):
21
21
  swagger_schema = None
22
22
 
23
23
  permission_classes = (AuthScopesRequired,)
24
- required_scopes = Scope(
25
- SCOPE_NOTIFICATIES_PUBLICEREN_LABEL
26
- ) # FIXME: this should be standalone!
24
+ required_scopes = Scope(SCOPE_NOTIFICATIES_PUBLICEREN_LABEL, private=True)
27
25
 
28
26
  def get_serializer(self, *args, **kwargs):
29
27
  return NotificatieSerializer(*args, **kwargs)
@@ -55,7 +53,9 @@ class NotificationBaseView(APIView):
55
53
  class NotificationView(NotificationBaseView):
56
54
  action = "create"
57
55
  permission_classes = (AuthScopesRequired,)
58
- required_scopes = {"create": Scope(SCOPE_NOTIFICATIES_PUBLICEREN_LABEL)}
56
+ required_scopes = {
57
+ "create": Scope(SCOPE_NOTIFICATIES_PUBLICEREN_LABEL, private=True)
58
+ }
59
59
 
60
60
  def create(self, request, *args, **kwargs):
61
61
  return self.post(request, *args, **kwargs)
@@ -302,7 +302,7 @@ class UniekeIdentificatieValidator:
302
302
  :param identificatie_field: naam van het veld dat de identificatie bevat
303
303
  """
304
304
 
305
- message = _("Deze identificatie bestaat al binnen de organisatie")
305
+ message = _("Deze identificatie ({identificatie}) bestaat al binnen de organisatie")
306
306
  code = "identificatie-niet-uniek"
307
307
  requires_context = True
308
308
 
@@ -345,7 +345,12 @@ class UniekeIdentificatieValidator:
345
345
 
346
346
  if combination_exists:
347
347
  raise serializers.ValidationError(
348
- {self.identificatie_field: self.message}, code=self.code
348
+ {
349
+ self.identificatie_field: self.message.format(
350
+ identificatie=identificatie
351
+ )
352
+ },
353
+ code=self.code,
349
354
  )
350
355
 
351
356