-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #331 from SELab-2/develop
Release
- Loading branch information
Showing
167 changed files
with
22,967 additions
and
8,161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
#@param | ||
# Vul hieronder de naam in dat het ingediende bestand moet hebben | ||
file_name="verslag.pdf" | ||
|
||
|
||
if [ -e "$file_name" ]; then | ||
echo "$file_name present: OK" | ||
else | ||
echo "$file_name not present: FAIL" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
#@param | ||
# Vul hieronder het type dat het bestand moet hebben | ||
file_type="pdf" | ||
|
||
|
||
file_exists=false | ||
for file in *.$file_type; do | ||
if [ -e "$file" ]; then | ||
file_exists=true | ||
break | ||
fi | ||
done | ||
|
||
if [ "$file_exists" = true ]; then | ||
echo "$file_type: OK" | ||
else | ||
echo "$file_type: FAIL" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
#@param | ||
# Vul hieronder de namen van de bestanden in die je in de gezipte folder wilt vinden. | ||
file_names=("testfile1.txt" "testfile2.txt") | ||
|
||
#@param | ||
# Vul hieronder de naam van het zip bestand waarin je de files wil vinden | ||
zip_file_name="file.zip" | ||
|
||
|
||
for file_name in "${file_names[@]}"; do | ||
unzip -l $zip_file_name | grep -q $file_name; | ||
if [ "$?" == "0" ] | ||
then | ||
echo "$file_name present: OK" | ||
else | ||
echo "$file_name not present: FAIL" | ||
fi; | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
yes | docker system prune -a >&2 | ||
docker build -t script-demo -f api/docker/Dockerfile . | ||
docker run --mount type=bind,source="$(pwd)"/data/restricties/project_$2,target=/data/restricties --mount type=bind,source="$(pwd)"/data/indieningen/indiening_$1,target=/data --name demo -d script-demo | ||
docker run --mount type=bind,source="$(pwd)"/data/restricties/project_$2,target=/restricties --mount type=bind,source="$(pwd)"/data/indieningen/indiening_$1,target=/data --name demo -d script-demo | ||
docker logs demo -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from django.contrib.auth.models import User | ||
from api.models.gebruiker import Gebruiker | ||
from api.serializers.gebruiker import GebruikerSerializer | ||
from api.serializers.template import TemplateSerializer | ||
from django.core.files import File | ||
import os | ||
|
||
|
||
class AuthenticationUserMiddleware: | ||
""" | ||
Middleware voor authenticatie van gebruikers en het aanmaken van gebruikersindeling. | ||
Args: | ||
get_response (callable): De volgende middleware in de keten. | ||
Returns: | ||
HttpResponse: Een HTTP-response-object. | ||
Raises: | ||
Redirect: Redirect naar de inlog-URL als er geen autorisatiegegevens zijn. | ||
""" | ||
|
||
def __init__(self, get_response): | ||
self.get_response = get_response | ||
|
||
def __call__(self, request): | ||
|
||
mail = "lesgever@testing.com" | ||
try: | ||
user = User.objects.get(username=mail) | ||
except User.DoesNotExist: | ||
user = User.objects.create_user( | ||
username=mail, | ||
email=mail, | ||
first_name="Lesgever", | ||
last_name="Testing", | ||
) | ||
|
||
request.user = user | ||
|
||
try: | ||
Gebruiker.objects.get(pk=request.user.id) | ||
except Gebruiker.DoesNotExist: | ||
directory_path = "api/base_templates" | ||
for filename in os.listdir(directory_path): | ||
file_path = os.path.join(directory_path, filename) | ||
with open(file_path, "rb") as f: | ||
django_file = File(f) | ||
template_data = {"user": request.user.id, "bestand": django_file} | ||
serializer = TemplateSerializer(data=template_data) | ||
if serializer.is_valid(): | ||
serializer.save() | ||
|
||
gebruiker_post_data = { | ||
"user": request.user.id, | ||
"subjects": [], | ||
"is_lesgever": True, | ||
} | ||
serializer = GebruikerSerializer(data=gebruiker_post_data) | ||
if serializer.is_valid(): | ||
serializer.save() | ||
|
||
return self.get_response(request) | ||
|
||
|
||
class DisableCSRFMiddleware(object): | ||
def __init__(self, get_response): | ||
self.get_response = get_response | ||
|
||
def __call__(self, request): | ||
setattr(request, "_dont_enforce_csrf_checks", True) | ||
response = self.get_response(request) | ||
return response |
Oops, something went wrong.