apis-acdhch-default-settings 0.1.23__py3-none-any.whl → 1.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.
- apis_acdhch_default_settings/ldapauth.py +12 -0
- apis_acdhch_default_settings/settings.py +14 -87
- {apis_acdhch_default_settings-0.1.23.dist-info → apis_acdhch_default_settings-1.0.0.dist-info}/METADATA +2 -1
- apis_acdhch_default_settings-1.0.0.dist-info/RECORD +7 -0
- {apis_acdhch_default_settings-0.1.23.dist-info → apis_acdhch_default_settings-1.0.0.dist-info}/WHEEL +1 -1
- apis_acdhch_default_settings-0.1.23.dist-info/RECORD +0 -6
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from django_auth_ldap.backend import LDAPBackend
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CustomLDAPBackend(LDAPBackend):
|
|
7
|
+
def authenticate_ldap_user(self, user, *args, **kwargs):
|
|
8
|
+
user_list = os.environ.get("AUTH_LDAP_USER_LIST", "").split(",")
|
|
9
|
+
user_list = list(map(str.strip, user_list))
|
|
10
|
+
if user._username not in user_list:
|
|
11
|
+
return None
|
|
12
|
+
return super().authenticate_ldap_user(user, *args, **kwargs)
|
|
@@ -63,8 +63,10 @@ PROJECT_DEFAULT_MD = {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
# Application definition
|
|
66
|
-
|
|
66
|
+
# put apis_override_select2js at the beginning of the list
|
|
67
|
+
# to make its static files weigh more than from the other apps
|
|
67
68
|
INSTALLED_APPS = [
|
|
69
|
+
"apis_override_select2js",
|
|
68
70
|
"dal",
|
|
69
71
|
"dal_select2",
|
|
70
72
|
"django.contrib.admin",
|
|
@@ -73,7 +75,6 @@ INSTALLED_APPS = [
|
|
|
73
75
|
"django.contrib.sessions",
|
|
74
76
|
"django.contrib.messages",
|
|
75
77
|
"django.contrib.staticfiles",
|
|
76
|
-
"reversion",
|
|
77
78
|
"crispy_forms",
|
|
78
79
|
"crispy_bootstrap4",
|
|
79
80
|
"django_filters",
|
|
@@ -92,10 +93,6 @@ INSTALLED_APPS = [
|
|
|
92
93
|
"apis_ontology",
|
|
93
94
|
]
|
|
94
95
|
|
|
95
|
-
# put apis_override_select2js at the beginning of the list
|
|
96
|
-
# to make its static files weigh more than from the other apps
|
|
97
|
-
INSTALLED_APPS = ["apis_override_select2js"] + INSTALLED_APPS
|
|
98
|
-
|
|
99
96
|
USE_X_FORWARDED_HOST = True
|
|
100
97
|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
|
101
98
|
|
|
@@ -147,10 +144,6 @@ REST_FRAMEWORK = {
|
|
|
147
144
|
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
|
148
145
|
}
|
|
149
146
|
|
|
150
|
-
AUTHENTICATION_BACKENDS = (
|
|
151
|
-
"django.contrib.auth.backends.ModelBackend", # this is default
|
|
152
|
-
)
|
|
153
|
-
|
|
154
147
|
MIDDLEWARE = [
|
|
155
148
|
"allow_cidr.middleware.AllowCIDRMiddleware",
|
|
156
149
|
"django.middleware.security.SecurityMiddleware",
|
|
@@ -161,7 +154,6 @@ MIDDLEWARE = [
|
|
|
161
154
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
162
155
|
"django.contrib.messages.middleware.MessageMiddleware",
|
|
163
156
|
"csp.middleware.CSPMiddleware",
|
|
164
|
-
"reversion.middleware.RevisionMiddleware",
|
|
165
157
|
"crum.CurrentRequestUserMiddleware",
|
|
166
158
|
]
|
|
167
159
|
|
|
@@ -187,9 +179,7 @@ TEMPLATES = [
|
|
|
187
179
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
|
|
188
180
|
|
|
189
181
|
AUTH_PASSWORD_VALIDATORS = [
|
|
190
|
-
{
|
|
191
|
-
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
|
|
192
|
-
},
|
|
182
|
+
{"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"},
|
|
193
183
|
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
|
|
194
184
|
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
|
|
195
185
|
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
|
|
@@ -223,87 +213,15 @@ MEDIA_URL = "/media/"
|
|
|
223
213
|
|
|
224
214
|
DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap4.html"
|
|
225
215
|
|
|
226
|
-
APIS_COMPONENTS = []
|
|
227
|
-
# APIS settings
|
|
228
|
-
|
|
229
|
-
APIS_TEI_TEXTS = ["xml/tei transcription"]
|
|
230
|
-
APIS_CETEICEAN_CSS = "https://teic.github.io/CETEIcean/css/CETEIcean.css"
|
|
231
|
-
APIS_CETEICEAN_JS = "https://teic.github.io/CETEIcean/js/CETEI.js"
|
|
232
|
-
|
|
233
216
|
APIS_NEXT_PREV = True
|
|
234
|
-
|
|
235
|
-
APIS_ALTERNATE_NAMES = [
|
|
236
|
-
"Taufname",
|
|
237
|
-
"Ehename",
|
|
238
|
-
"Name laut ÖBL XML",
|
|
239
|
-
"alternative Namensform",
|
|
240
|
-
"alternative name",
|
|
241
|
-
"Künstlername",
|
|
242
|
-
"Mädchenname",
|
|
243
|
-
"Pseudonym",
|
|
244
|
-
"weitere Namensform",
|
|
245
|
-
]
|
|
246
|
-
|
|
247
|
-
APIS_RELATIONS_FILTER_EXCLUDE = [
|
|
248
|
-
"*uri*",
|
|
249
|
-
"*tempentityclass*",
|
|
250
|
-
"user",
|
|
251
|
-
"*__id",
|
|
252
|
-
"*source*",
|
|
253
|
-
"label",
|
|
254
|
-
"*temp_entity*",
|
|
255
|
-
"*collection*",
|
|
256
|
-
"*published*",
|
|
257
|
-
"*_set",
|
|
258
|
-
"*_set__*",
|
|
259
|
-
"_ptr",
|
|
260
|
-
"baseclass",
|
|
261
|
-
"*id",
|
|
262
|
-
"*written*",
|
|
263
|
-
"relation_type__*",
|
|
264
|
-
"*__text*",
|
|
265
|
-
"text*",
|
|
266
|
-
"*annotation_set_relation*",
|
|
267
|
-
"*start_start_date*",
|
|
268
|
-
"*end_end_date*",
|
|
269
|
-
"*start_end_date*",
|
|
270
|
-
"*end_start_date*",
|
|
271
|
-
"*label*",
|
|
272
|
-
"*review*",
|
|
273
|
-
"*__name",
|
|
274
|
-
"*__status",
|
|
275
|
-
"*__references",
|
|
276
|
-
"*__notes",
|
|
277
|
-
]
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
APIS_VOCABULARIES = {"exclude": ["userAdded"]}
|
|
282
|
-
|
|
283
|
-
APIS_METAINFO = {"exclude": ["groups_allowed"]}
|
|
284
|
-
|
|
285
|
-
# TODO RDF: Remove this dictionary from settings entirely and attach it only to entity models
|
|
286
|
-
APIS_ENTITIES = {}
|
|
287
|
-
|
|
288
217
|
APIS_API_EXCLUDE_SETS = True # exclude reverse links to entities
|
|
289
|
-
|
|
290
218
|
APIS_LIST_VIEWS_ALLOWED = False
|
|
291
219
|
APIS_DETAIL_VIEWS_ALLOWED = False
|
|
292
220
|
MAX_AGE = 60 * 60
|
|
293
221
|
|
|
294
|
-
APIS_IIIF_WORK_KIND = "IIIF"
|
|
295
|
-
APIS_IIIF_ENT_IIIF_REL = "has iiif image"
|
|
296
|
-
APIS_IIIF_SERVER = "https://iiif.acdh.oeaw.ac.at/"
|
|
297
|
-
APIS_OSD_JS = (
|
|
298
|
-
"https://cdnjs.cloudflare.com/ajax/libs/openseadragon/2.4.0/openseadragon.min.js"
|
|
299
|
-
)
|
|
300
|
-
APIS_OSD_IMG_PREFIX = (
|
|
301
|
-
"https://cdnjs.cloudflare.com/ajax/libs/openseadragon/2.4.0/images/"
|
|
302
|
-
)
|
|
303
|
-
|
|
304
222
|
ALLOWED_CIDR_NETS = ["10.0.0.0/8", "127.0.0.0/8"]
|
|
305
223
|
|
|
306
|
-
DATABASES = {
|
|
224
|
+
DATABASES = {'default': dj_database_url.config(default='sqlite:///db.sqlite3', conn_max_age=600)}
|
|
307
225
|
|
|
308
226
|
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
|
|
309
227
|
if os.environ.get("PUBLIC_URL"):
|
|
@@ -311,3 +229,12 @@ if os.environ.get("PUBLIC_URL"):
|
|
|
311
229
|
|
|
312
230
|
if os.environ.get("ALLOWED_HOSTS"):
|
|
313
231
|
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS").split(",")
|
|
232
|
+
|
|
233
|
+
if os.environ.get("AUTH_LDAP_USER_LIST", False):
|
|
234
|
+
AUTH_LDAP_SERVER_URI = os.environ.get("ARZ_AUTH_LDAP_SERVER_URI")
|
|
235
|
+
AUTH_LDAP_USER_DN_TEMPLATE = "%(user)s@oeaw.ads"
|
|
236
|
+
|
|
237
|
+
AUTHENTICATION_BACKENDS = [
|
|
238
|
+
"apis_acdhch_default_settings.ldapauth.CustomLDAPBackend",
|
|
239
|
+
"django.contrib.auth.backends.ModelBackend",
|
|
240
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apis-acdhch-default-settings
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Default settings for APIS instances at the ACDH-CH
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Birger Schacht
|
|
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Requires-Dist: dj-database-url (>=2.0.0,<3.0.0)
|
|
14
14
|
Requires-Dist: django-allow-cidr (>=0.6.0,<0.7.0)
|
|
15
|
+
Requires-Dist: django-auth-ldap (>=4.6.0,<5.0.0)
|
|
15
16
|
Requires-Dist: django-csp (>=3.7,<4.0)
|
|
16
17
|
Requires-Dist: sentry-sdk (>=1.26.0,<2.0.0)
|
|
17
18
|
Requires-Dist: whitenoise (>=5.2.0,<6.0.0)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
apis_acdhch_default_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
apis_acdhch_default_settings/ldapauth.py,sha256=P1NDgWG2Pp4JzqoETq3VDC3DtECoEIXWBA3Lzn6CUIA,423
|
|
3
|
+
apis_acdhch_default_settings/settings.py,sha256=8wDCsEU2fmdJWybksDYWCwn0k5vsBCU7gOpFiL_K3yQ,7352
|
|
4
|
+
apis_acdhch_default_settings/urls.py,sha256=VDvjdb940573U-xuwGYwYZTJJRgTeSgnlNCm7Hj8kGs,946
|
|
5
|
+
apis_acdhch_default_settings-1.0.0.dist-info/METADATA,sha256=UkgYygh1DHEXIsCTHuCCOAH7iAaqufcLuWUJaBbHTqo,903
|
|
6
|
+
apis_acdhch_default_settings-1.0.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
7
|
+
apis_acdhch_default_settings-1.0.0.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
apis_acdhch_default_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
apis_acdhch_default_settings/settings.py,sha256=1mm8RF_bncJGMwYdeyoAsb3VUV1yDsZeahI3T82lAig,8776
|
|
3
|
-
apis_acdhch_default_settings/urls.py,sha256=VDvjdb940573U-xuwGYwYZTJJRgTeSgnlNCm7Hj8kGs,946
|
|
4
|
-
apis_acdhch_default_settings-0.1.23.dist-info/METADATA,sha256=MNbHZYGKzNflZaB3XWhji-g-h6xsc1SSfoQHs1NkdtQ,855
|
|
5
|
-
apis_acdhch_default_settings-0.1.23.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
6
|
-
apis_acdhch_default_settings-0.1.23.dist-info/RECORD,,
|