.
This commit is contained in:
@@ -18,5 +18,6 @@ GUNICORN_WORKERS=3
|
|||||||
GUNICORN_LOGLEVEL=info
|
GUNICORN_LOGLEVEL=info
|
||||||
|
|
||||||
# Nginx host ports for local development (override prod defaults)
|
# Nginx host ports for local development (override prod defaults)
|
||||||
NGINX_HTTP_PORT=8000
|
NGINX_HTTP_PORT=8080
|
||||||
NGINX_HTTPS_PORT=8443
|
# Pick a non-privileged HTTPS port to avoid conflicts with host installs
|
||||||
|
NGINX_HTTPS_PORT=8444
|
||||||
@@ -16,3 +16,5 @@ temp/
|
|||||||
# Loki runtime data
|
# Loki runtime data
|
||||||
/docker/loki-data/
|
/docker/loki-data/
|
||||||
/docker/loki-wal/
|
/docker/loki-wal/
|
||||||
|
# Local runtime logs collected by Promtail
|
||||||
|
/logs/
|
||||||
@@ -7,6 +7,10 @@ server {
|
|||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
|
# Write logs to the host-mounted folder so Promtail can scrape them
|
||||||
|
access_log /var/log/rad/nginx.access.log combined;
|
||||||
|
error_log /var/log/rad/nginx.error.log warn;
|
||||||
|
|
||||||
client_max_body_size 100M;
|
client_max_body_size 100M;
|
||||||
|
|
||||||
location /static/ {
|
location /static/ {
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ server {
|
|||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
|
# Write logs to the host-mounted folder so Promtail can scrape them
|
||||||
|
access_log /var/log/rad/nginx.access.log combined;
|
||||||
|
error_log /var/log/rad/nginx.error.log warn;
|
||||||
|
|
||||||
client_max_body_size 100M;
|
client_max_body_size 100M;
|
||||||
|
|
||||||
# Serve static files from the static volume
|
# Serve static files from the static volume
|
||||||
@@ -112,6 +116,10 @@ server {
|
|||||||
|
|
||||||
client_max_body_size 4G;
|
client_max_body_size 4G;
|
||||||
|
|
||||||
|
# Write logs to the host-mounted folder so Promtail can scrape them
|
||||||
|
access_log /var/log/rad/nginx.access.log combined;
|
||||||
|
error_log /var/log/rad/nginx.error.log warn;
|
||||||
|
|
||||||
# Same static/media handling as above
|
# Same static/media handling as above
|
||||||
location /static/ { alias /usr/src/app/static/; }
|
location /static/ { alias /usr/src/app/static/; }
|
||||||
location /media { alias /usr/src/app/media; }
|
location /media { alias /usr/src/app/media; }
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ services:
|
|||||||
image: nginx:1.25-alpine
|
image: nginx:1.25-alpine
|
||||||
volumes:
|
volumes:
|
||||||
- ../deploy/nginx/dev.conf:/etc/nginx/conf.d/default.conf:ro
|
- ../deploy/nginx/dev.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
- ../logs:/var/log/rad:rw
|
||||||
|
|
||||||
loki:
|
loki:
|
||||||
image: grafana/loki:2.8.2
|
image: grafana/loki:2.8.2
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ services:
|
|||||||
- web
|
- web
|
||||||
volumes:
|
volumes:
|
||||||
- ../deploy/nginx/prod.conf:/etc/nginx/conf.d/default.conf:ro
|
- ../deploy/nginx/prod.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
- ../logs:/var/log/rad:rw
|
||||||
- static_volume:/usr/src/app/static:ro
|
- static_volume:/usr/src/app/static:ro
|
||||||
- media_volume:/usr/src/app/media:ro
|
- media_volume:/usr/src/app/media:ro
|
||||||
- ../deploy/nginx/certs:/etc/letsencrypt:ro
|
- ../deploy/nginx/certs:/etc/letsencrypt:ro
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ class AuthorMixin():
|
|||||||
|
|
||||||
def is_author(self, user: User) -> bool:
|
def is_author(self, user: User) -> bool:
|
||||||
"""Returns True if the user is an author of the object"""
|
"""Returns True if the user is an author of the object"""
|
||||||
|
if user.is_superuser:
|
||||||
|
return True
|
||||||
|
|
||||||
return self.author.filter(id=user.id).exists()
|
return self.author.filter(id=user.id).exists()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1774,7 +1774,7 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
def exam_list_collection(self, request, collection_id):
|
def exam_list_collection(self, request, collection_id):
|
||||||
collection = get_object_or_404(ExamCollection, pk=collection_id)
|
collection = get_object_or_404(ExamCollection, pk=collection_id)
|
||||||
|
|
||||||
if not request.user in collection.author.all():
|
if not collection.is_author(request.user):
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
|
|
||||||
return self.exam_list(request, all=True, collection=collection)
|
return self.exam_list(request, all=True, collection=collection)
|
||||||
|
|||||||
Reference in New Issue
Block a user