Compare commits
9
Commits
120e04ce2a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2364f93bbe | ||
|
|
759e64a146 | ||
|
|
10e859dcde | ||
|
|
795c87e889 | ||
|
|
df92f1b960 | ||
|
|
2028dbf4fa | ||
|
|
cadbc9d8d2 | ||
|
|
5803372f35 | ||
|
|
8049bf2194 |
No files matched your search
Binary file not shown.
File renamed without changes.
File renamed without changes.
BIN
Binary file not shown.
File renamed without changes.
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
ASGI config for drm_server project.
|
||||
ASGI config for Contentserver project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
@@ -11,6 +11,6 @@ import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drm_server.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Contentserver.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Django settings for drm_server project.
|
||||
Django settings for Contentserver project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 3.1.4.
|
||||
|
||||
@@ -66,7 +66,7 @@ MIDDLEWARE = [
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'drm_server.urls'
|
||||
ROOT_URLCONF = 'Contentserver.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
@@ -84,7 +84,7 @@ TEMPLATES = [
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'drm_server.wsgi.application'
|
||||
WSGI_APPLICATION = 'Contentserver.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
WSGI config for drm_server project.
|
||||
WSGI config for Contentserver project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
@@ -11,6 +11,6 @@ import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drm_server.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Contentserver.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
"@babel/preset-env", "@babel/preset-react"
|
||||
]
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import FolderInfo, FolderPart, JustifiedKey, FolderPart_Name
|
||||
|
||||
admin.site.register(FolderInfo)
|
||||
admin.site.register(FolderPart)
|
||||
admin.site.register(FolderPart_Name)
|
||||
admin.site.register(JustifiedKey)
|
||||
|
||||
#@admin.register(BookInstance)
|
||||
#class BookInstanceAdmin(admin.ModelAdmin):
|
||||
# list_display = ('book', 'status', 'borrower', 'due_back', 'id')
|
||||
# list_filter = ('status', 'due_back')#
|
||||
#
|
||||
# fieldsets = (
|
||||
# (None, {
|
||||
# 'fields': ('book','imprint', 'id')
|
||||
# }),
|
||||
# ('Availability', {
|
||||
# 'fields': ('status', 'due_back','borrower')
|
||||
# }),
|
||||
# )
|
||||
-4159
File diff suppressed because it is too large.
Load diff
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "webpack --mode development ./src/index.js --output-path ./static/frontend/",
|
||||
"build": "webpack --mode production ./src/index.js --output-path ./static/frontend/"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/plugin-transform-runtime": "^7.12.10",
|
||||
"@babel/preset-env": "^7.12.11",
|
||||
"@babel/preset-react": "^7.12.10",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babelify": "^10.0.0",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
"webpack": "^5.11.0",
|
||||
"webpack-cli": "^4.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"assert": "^2.0.0",
|
||||
"browserify": "^17.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"buffer-browserify": "^0.2.5",
|
||||
"create-react-class": "^15.7.0",
|
||||
"crypto": "^1.0.1",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"jquery": "^3.5.1",
|
||||
"process": "^0.11.10",
|
||||
"stream-browserify": "^3.0.0"
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
const webpack = require('webpack');
|
||||
|
||||
module.exports = {
|
||||
resolve:{fallback: { "crypto": require.resolve("crypto-browserify"),
|
||||
"stream": require.resolve("stream-browserify"),
|
||||
"buffer": require.resolve("buffer-browserify"),
|
||||
"path": require.resolve("path-browserify"),
|
||||
"assert": require.resolve("assert/")}},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
presets: ["@babel/preset-env", "@babel/preset-react"],
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
process: 'process/browser',
|
||||
'process.env.POUCHDB_NAME': JSON.stringify(process.env.POUCHDB_NAME || 'mydb'),
|
||||
})
|
||||
],
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,9 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import FolderInfo, FolderPart, JustifiedKey, FolderPart_Name
|
||||
|
||||
admin.site.register(FolderInfo)
|
||||
admin.site.register(FolderPart)
|
||||
admin.site.register(FolderPart_Name)
|
||||
admin.site.register(JustifiedKey)
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,90 @@
|
||||
appdirs==1.4.4
|
||||
apturl==0.5.2
|
||||
asgiref==3.3.1
|
||||
bcrypt==3.1.7
|
||||
blinker==1.4
|
||||
Brlapi==0.7.0
|
||||
certifi==2019.11.28
|
||||
chardet==3.0.4
|
||||
Click==7.0
|
||||
colorama==0.4.3
|
||||
command-not-found==0.3
|
||||
crypto==1.4.1
|
||||
cryptography==2.8
|
||||
cupshelpers==1.0
|
||||
dbus-python==1.2.16
|
||||
defer==1.0.6
|
||||
distlib==0.3.1
|
||||
distro==1.4.0
|
||||
distro-info===0.23ubuntu1
|
||||
Django==3.1.4
|
||||
django-cors-headers==3.7.0
|
||||
django-filter==2.4.0
|
||||
djangorestframework==3.12.2
|
||||
duplicity==0.8.12.0
|
||||
ecdsa==0.16.1
|
||||
entrypoints==0.3
|
||||
fasteners==0.14.1
|
||||
filelock==3.0.12
|
||||
future==0.18.2
|
||||
httpie==1.0.3
|
||||
httplib2==0.14.0
|
||||
idna==2.8
|
||||
keyring==18.0.1
|
||||
language-selector==0.1
|
||||
launchpadlib==1.10.13
|
||||
lazr.restfulclient==0.14.2
|
||||
lazr.uri==1.0.3
|
||||
lockfile==0.12.2
|
||||
louis==3.12.0
|
||||
macaroonbakery==1.3.1
|
||||
Mako==1.1.0
|
||||
Markdown==3.3.3
|
||||
MarkupSafe==1.1.0
|
||||
monotonic==1.5
|
||||
Naked==0.1.31
|
||||
netifaces==0.10.4
|
||||
oauthlib==3.1.0
|
||||
olefile==0.46
|
||||
paramiko==2.6.0
|
||||
pexpect==4.6.0
|
||||
Pillow==7.0.0
|
||||
protobuf==3.6.1
|
||||
pycairo==1.16.2
|
||||
pycrypto==2.6.1
|
||||
pycryptodome==3.9.9
|
||||
pycups==1.9.73
|
||||
Pygments==2.3.1
|
||||
PyGObject==3.36.0
|
||||
PyJWT==1.7.1
|
||||
pymacaroons==0.13.0
|
||||
PyNaCl==1.3.0
|
||||
PyQt5==5.15.1
|
||||
PyQt5-sip==12.8.1
|
||||
pyqt5-tools==5.15.1.1.7.4
|
||||
pyRFC3339==1.1
|
||||
python-apt==2.0.0+ubuntu0.20.4.3
|
||||
python-dateutil==2.7.3
|
||||
python-debian===0.1.36ubuntu1
|
||||
python-dotenv==0.14.0
|
||||
pytz==2019.3
|
||||
pyxdg==0.26
|
||||
PyYAML==5.3.1
|
||||
reportlab==3.5.34
|
||||
requests==2.22.0
|
||||
requests-unixsocket==0.2.0
|
||||
SecretStorage==2.3.1
|
||||
shellescape==3.8.1
|
||||
simplejson==3.16.0
|
||||
six==1.14.0
|
||||
sqlparse==0.4.1
|
||||
systemd-python==234
|
||||
ubuntu-advantage-tools==20.3
|
||||
ubuntu-drivers-common==0.0.0
|
||||
ufw==0.36
|
||||
unattended-upgrades==0.1
|
||||
urllib3==1.25.8
|
||||
usb-creator==0.3.7
|
||||
virtualenv==20.2.2
|
||||
wadllib==1.3.3
|
||||
xkit==0.0.0
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,26 +1,9 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Author, Genre, Book, BookInstance, FolderInfo, Permission, License, FolderPart
|
||||
from .models import FolderInfo, Permission, License, FolderPart
|
||||
|
||||
#admin.site.register(Book)
|
||||
#admin.site.register(Author)
|
||||
#admin.site.register(Genre)
|
||||
admin.site.register(FolderInfo)
|
||||
admin.site.register(License)
|
||||
admin.site.register(FolderPart)
|
||||
admin.site.register(Permission)
|
||||
|
||||
|
||||
#@admin.register(BookInstance)
|
||||
#class BookInstanceAdmin(admin.ModelAdmin):
|
||||
# list_display = ('book', 'status', 'borrower', 'due_back', 'id')
|
||||
# list_filter = ('status', 'due_back')#
|
||||
#
|
||||
# fieldsets = (
|
||||
# (None, {
|
||||
# 'fields': ('book','imprint', 'id')
|
||||
# }),
|
||||
# ('Availability', {
|
||||
# 'fields': ('status', 'due_back','borrower')
|
||||
# }),
|
||||
# )
|
||||
@@ -1,6 +1,5 @@
|
||||
from health_view.models import *
|
||||
from health_view.views import check_expiration_date
|
||||
from datetime import datetime
|
||||
import health_view.views
|
||||
from health_view.crypto_functions import *
|
||||
import requests
|
||||
import json
|
||||
@@ -12,39 +11,43 @@ passwort_restapi = 'Lolo7138'
|
||||
|
||||
def check_exp_date():
|
||||
licenses = License.objects.all()
|
||||
date_now = datetime.now()
|
||||
print("did it")
|
||||
for lic in licenses:
|
||||
if check_expiration_date(lic):
|
||||
if health_view.views.check_expiration_date(lic):
|
||||
continue
|
||||
licenses_same_owner = License.objects.filter(justified=lic.justified, patient=lic.patient).exclude(id=lic.id)
|
||||
folderparts = lic.folder_parts.all().values_list()
|
||||
parts_to_delete = list()
|
||||
for part in folderparts:
|
||||
delete = True
|
||||
for license in licenses_same_owner:
|
||||
if not check_expiration_date(license):
|
||||
continue
|
||||
for check_part in license.folder_parts.all().values_list():
|
||||
if check_part == part:
|
||||
delete = False
|
||||
if delete is True:
|
||||
parts_to_delete.append(part[2])
|
||||
if not parts_to_delete:
|
||||
lic.delete()
|
||||
continue
|
||||
new_total_key = make_encrypted_key_content_server()
|
||||
post_content = {
|
||||
'patient': lic.patient.username,
|
||||
'justified': lic.justified.username,
|
||||
'new_total_key': new_total_key,
|
||||
'old_total_key': lic.patient.folderinfo.content_key,
|
||||
'folder_parts': parts_to_delete,
|
||||
}
|
||||
lic.patient.folderinfo.content_key = new_total_key
|
||||
lic.patient.folderinfo.save()
|
||||
filter_license_and_delete(lic)
|
||||
|
||||
|
||||
def filter_license_and_delete(lic):
|
||||
print(lic.justified)
|
||||
licenses_same_owner = License.objects.filter(justified=lic.justified, patient=lic.patient).exclude(id=lic.id)
|
||||
folderparts = lic.folder_parts.all().values_list()
|
||||
parts_to_delete = list()
|
||||
for part in folderparts:
|
||||
delete = True
|
||||
for license in licenses_same_owner:
|
||||
if not health_view.views.check_expiration_date(license):
|
||||
continue
|
||||
for check_part in license.folder_parts.all().values_list():
|
||||
if check_part == part:
|
||||
delete = False
|
||||
if delete is True:
|
||||
parts_to_delete.append(part[2])
|
||||
if not parts_to_delete:
|
||||
lic.delete()
|
||||
request = requests.post('http://192.168.192.75:8000/manage/delete/', json=post_content, auth=(loginname_restapi, passwort_restapi))
|
||||
|
||||
|
||||
return
|
||||
new_total_key = make_encrypted_key_content_server()
|
||||
post_content = {
|
||||
'patient': lic.patient.username,
|
||||
'justified': lic.justified.username,
|
||||
'new_total_key': new_total_key,
|
||||
'old_total_key': lic.patient.folderinfo.content_key,
|
||||
'folder_parts': parts_to_delete,
|
||||
}
|
||||
lic.patient.folderinfo.content_key = new_total_key
|
||||
lic.patient.folderinfo.save()
|
||||
lic.delete()
|
||||
request = requests.post('http://192.168.192.75:8000/manage/delete/', json=post_content, auth=(loginname_restapi, passwort_restapi))
|
||||
return
|
||||
|
||||
|
||||
@@ -8,5 +8,5 @@ urlpatterns = [
|
||||
path('license/<int:fid>/create/', views.create_license, name='create-license'),
|
||||
path('license/show/<int:pk>/own/', views.get_license_details, name='license-detail-own'),
|
||||
path('license/show/<int:pk>/given/', views.get_license_details, name='license-detail-given'),
|
||||
path('delete_license', views.delete_license, name='delete_license')
|
||||
path('delete_license/<int:id>', views.delete_license, name='delete_license')
|
||||
]
|
||||
@@ -180,5 +180,7 @@ def create_license(request, fid):
|
||||
return render(request, 'health_view/create_license.html', context)
|
||||
|
||||
|
||||
def delete_license(request):
|
||||
print("test")
|
||||
def delete_license(request, id):
|
||||
license = get_object_or_404(License, id=id)
|
||||
health_view.cron.filter_license_and_delete(license)
|
||||
return HttpResponseRedirect('/health_view/givenlicenses/')
|
||||
@@ -0,0 +1,86 @@
|
||||
appdirs==1.4.4
|
||||
apturl==0.5.2
|
||||
asgiref==3.3.1
|
||||
bcrypt==3.1.7
|
||||
blinker==1.4
|
||||
Brlapi==0.7.0
|
||||
certifi==2019.11.28
|
||||
chardet==3.0.4
|
||||
Click==7.0
|
||||
colorama==0.4.3
|
||||
command-not-found==0.3
|
||||
crypto==1.4.1
|
||||
cryptography==2.8
|
||||
cupshelpers==1.0
|
||||
dbus-python==1.2.16
|
||||
defer==1.0.6
|
||||
distlib==0.3.1
|
||||
distro==1.4.0
|
||||
distro-info===0.23ubuntu1
|
||||
Django==3.1.4
|
||||
django-crontab==0.7.1
|
||||
duplicity==0.8.12.0
|
||||
ecdsa==0.16.1
|
||||
entrypoints==0.3
|
||||
fasteners==0.14.1
|
||||
filelock==3.0.12
|
||||
future==0.18.2
|
||||
httplib2==0.14.0
|
||||
idna==2.8
|
||||
keyring==18.0.1
|
||||
language-selector==0.1
|
||||
launchpadlib==1.10.13
|
||||
lazr.restfulclient==0.14.2
|
||||
lazr.uri==1.0.3
|
||||
lockfile==0.12.2
|
||||
louis==3.12.0
|
||||
macaroonbakery==1.3.1
|
||||
Mako==1.1.0
|
||||
MarkupSafe==1.1.0
|
||||
monotonic==1.5
|
||||
Naked==0.1.31
|
||||
netifaces==0.10.4
|
||||
oauthlib==3.1.0
|
||||
olefile==0.46
|
||||
paramiko==2.6.0
|
||||
pexpect==4.6.0
|
||||
Pillow==7.0.0
|
||||
protobuf==3.6.1
|
||||
pycairo==1.16.2
|
||||
pycrypto==2.6.1
|
||||
pycryptodome==3.9.9
|
||||
pycups==1.9.73
|
||||
Pygments==2.3.1
|
||||
PyGObject==3.36.0
|
||||
PyJWT==1.7.1
|
||||
pymacaroons==0.13.0
|
||||
PyNaCl==1.3.0
|
||||
PyQt5==5.15.1
|
||||
PyQt5-sip==12.8.1
|
||||
pyqt5-tools==5.15.1.1.7.4
|
||||
pyRFC3339==1.1
|
||||
python-apt==2.0.0+ubuntu0.20.4.3
|
||||
python-dateutil==2.7.3
|
||||
python-debian===0.1.36ubuntu1
|
||||
python-dotenv==0.14.0
|
||||
pytz==2019.3
|
||||
pyxdg==0.26
|
||||
PyYAML==5.3.1
|
||||
reportlab==3.5.34
|
||||
requests==2.22.0
|
||||
requests-unixsocket==0.2.0
|
||||
SecretStorage==2.3.1
|
||||
shellescape==3.8.1
|
||||
simplejson==3.16.0
|
||||
six==1.14.0
|
||||
sqlparse==0.4.1
|
||||
systemd-python==234
|
||||
ubuntu-advantage-tools==20.3
|
||||
ubuntu-drivers-common==0.0.0
|
||||
ufw==0.36
|
||||
unattended-upgrades==0.1
|
||||
urllib3==1.25.8
|
||||
usb-creator==0.3.7
|
||||
virtualenv==20.2.2
|
||||
wadllib==1.3.3
|
||||
xkit==0.0.0
|
||||
Reference in new issue
Block a user