Compare commits

..

1 Commits

Author SHA1 Message Date
Frank Lanitz
fc1681928b Add a CLI to delete a user with it's profile information 2022-01-23 21:56:52 +01:00
303 changed files with 633 additions and 1902 deletions

View File

@ -4,17 +4,10 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
kind: pipeline
type: docker
name: qa
trigger:
event:
- push
- pull_request
branch:
- main
name: default
steps:
- name: install-lint-test
- name: qa
image: registry.wtf-eg.net/ki-backend-builder:1.0.0
commands:
- pipenv install --dev
@ -22,25 +15,7 @@ steps:
- pipenv run reuse lint
- pipenv run python -m unittest discover ki
image_pull_secrets:
- dockerconfig
---
kind: pipeline
type: docker
name: build
trigger:
event:
- push
branch:
- main
depends_on:
- qa
steps:
- name: docker-publish
- name: docker-publish
image: plugins/docker
settings:
registry: registry.wtf-eg.net
@ -51,63 +26,9 @@ steps:
from_secret: "docker_username"
password:
from_secret: "docker_password"
---
kind: pipeline
type: docker
name: deploy
trigger:
event:
- push
when:
branch:
- main
depends_on:
- build
steps:
- name: deploy-dev
image: appleboy/drone-ssh
settings:
host:
- dev01.wtf-eg.net
username: drone_deployment
key:
from_secret: "dev01_deployment_key"
command_timeout: 2m
script:
- echo "Executing forced command..."
---
kind: pipeline
type: docker
name: tag-release
trigger:
event:
- tag
steps:
- name: install-lint-test
image: registry.wtf-eg.net/ki-backend-builder:1.0.0
commands:
- pipenv install --dev
- pipenv run flake8
- pipenv run reuse lint
- pipenv run python -m unittest discover ki
- name: docker-publish
image: plugins/docker
settings:
registry: registry.wtf-eg.net
repo: registry.wtf-eg.net/ki-backend
target: ki-backend
auto_tag: true
username:
from_secret: "docker_username"
password:
from_secret: "docker_password"
image_pull_secrets:
- dockerconfig
- dockerconfig

View File

@ -4,7 +4,7 @@ Upstream-Contact: Michael Weimann <mail@michael-weimann.eu>
Source: https://git.wtf-eg.de/kompetenzinventar/ki-backend
Files: data/imgs/flags/*
Copyright: 2013 Panayiotis Lipiridis <https://flagicons.lipis.dev/>
Copyright: 2017 Go Squared Ltd. http://www.gosquared.com/
License: MIT
Files: Pipfile.lock migrations/*

View File

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later
FROM registry.wtf-eg.net/ki-backend-builder:1.0.1 as builder
FROM registry.wtf-eg.net/ki-backend-builder:1.0.0 as builder
COPY Pipfile* ./
@ -10,7 +10,7 @@ RUN PIP_USER=1 PIP_IGNORE_INSTALLED=1 pipenv install --system --deploy --ignore-
RUN pip3 uninstall --yes pipenv
FROM registry.wtf-eg.net/ki-backend-base:1.0.1 as ki-backend
FROM registry.wtf-eg.net/ki-backend-base:1.0.0 as ki-backend
# Install six explicitly. Otherwise Python complains about it missing.
RUN pip3 install six
@ -22,9 +22,4 @@ WORKDIR /app
COPY . .
LABEL org.opencontainers.image.source=https://git.wtf-eg.de/kompetenzinventar/ki-backend.git
LABEL org.opencontainers.image.url=https://git.wtf-eg.de/kompetenzinventar/ki-backend
LABEL org.opencontainers.image.documentation=https://git.wtf-eg.de/kompetenzinventar/ki-backend#docker
LABEL org.opencontainers.image.vendor="WTF Kooperative eG"
CMD ["python3", "run_prod.py"]

View File

@ -14,7 +14,7 @@ flask-migrate = "~=3.0.1"
flask-sqlalchemy = "~=2.5.1"
sqlalchemy = "~=1.4.18"
waitress = "~=2.0.0"
pyyaml = "~=6.0.1"
pyyaml = "~=5.4.1"
flask-cors = "~=3.0.10"
ldap3 = "~=2.9"
pymysql = "~=1.0.2"

860
Pipfile.lock generated

File diff suppressed because it is too large Load Diff

15
app.py
View File

@ -8,23 +8,22 @@ import os
from dotenv import load_dotenv, find_dotenv
from flask import Flask
from flask_cors import CORS
from flask.logging import default_handler
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from ldap3.utils.log import logger as ldap3_logger
from ldap3.utils.log import set_library_log_detail_level, BASIC
load_dotenv(find_dotenv())
app = Flask(__name__)
# Configure logging
loglevel = os.getenv("KI_LOGLEVEL", logging.WARNING)
loglevel = int(loglevel)
app.logger.setLevel(loglevel)
app.logger.propagate = False # do not forward messages to the root logger
logging.basicConfig(level=loglevel,
format='[%(asctime)s] %(levelname)s [%(name)s] %(message)s') # configure root logger as fallback
logging.getLogger('werkzeug').propagate = False # werkzeug has its own ColorStreamHandler
set_library_log_detail_level(BASIC) # ldap3 has different verbosity levels internally
logging.basicConfig(level=loglevel)
set_library_log_detail_level(BASIC)
ldap3_logger.addHandler(default_handler)
app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("SQLALCHEMY_DATABASE_URI")
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
@ -41,6 +40,6 @@ CORS(app)
db = SQLAlchemy(app)
migrate = Migrate(app, db, compare_type=True)
app.logger.info("Hello from KI")
logging.debug("Hello from KI")
from ki import module # noqa

11
data/imgs/flags/Pipfile Normal file
View File

@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
python_version = "3.8"

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

BIN
data/imgs/flags/_kosovo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/imgs/flags/_mars.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

BIN
data/imgs/flags/_nato.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/imgs/flags/_wales.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
data/imgs/flags/ad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/imgs/flags/ae.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

BIN
data/imgs/flags/af.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
data/imgs/flags/ag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

BIN
data/imgs/flags/ai.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
data/imgs/flags/al.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/imgs/flags/am.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

BIN
data/imgs/flags/an.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

BIN
data/imgs/flags/ao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
data/imgs/flags/aq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
data/imgs/flags/ar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

BIN
data/imgs/flags/as.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
data/imgs/flags/at.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

BIN
data/imgs/flags/au.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

BIN
data/imgs/flags/aw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

BIN
data/imgs/flags/ax.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

BIN
data/imgs/flags/az.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

BIN
data/imgs/flags/ba.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

BIN
data/imgs/flags/bb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

BIN
data/imgs/flags/bd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

BIN
data/imgs/flags/be.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

BIN
data/imgs/flags/bf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

BIN
data/imgs/flags/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

View File

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-bg" viewBox="0 0 640 480">
<g fill-rule="evenodd" stroke-width="1pt">
<path fill="#d62612" d="M0 320h640v160H0z"/>
<path fill="#fff" d="M0 0h640v160H0z"/>
<path fill="#00966e" d="M0 160h640v160H0z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 283 B

BIN
data/imgs/flags/bh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

BIN
data/imgs/flags/bi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
data/imgs/flags/bj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

BIN
data/imgs/flags/bl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
data/imgs/flags/bm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
data/imgs/flags/bn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
data/imgs/flags/bo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

BIN
data/imgs/flags/br.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
data/imgs/flags/bs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

BIN
data/imgs/flags/bt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
data/imgs/flags/bw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

BIN
data/imgs/flags/by.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

BIN
data/imgs/flags/bz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
data/imgs/flags/ca.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

BIN
data/imgs/flags/cc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

BIN
data/imgs/flags/cd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/imgs/flags/cf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

BIN
data/imgs/flags/cg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

BIN
data/imgs/flags/ch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

BIN
data/imgs/flags/ci.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

BIN
data/imgs/flags/ck.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
data/imgs/flags/cl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

BIN
data/imgs/flags/cm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

BIN
data/imgs/flags/cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

BIN
data/imgs/flags/co.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

BIN
data/imgs/flags/cr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

BIN
data/imgs/flags/cs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

View File

@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-cz" viewBox="0 0 640 480">
<path fill="#fff" d="M0 0h640v240H0z"/>
<path fill="#d7141a" d="M0 240h640v240H0z"/>
<path fill="#11457e" d="M360 240 0 0v480z"/>
</svg>

Before

Width:  |  Height:  |  Size: 225 B

BIN
data/imgs/flags/ct.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
data/imgs/flags/cu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

BIN
data/imgs/flags/cv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

BIN
data/imgs/flags/cw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

BIN
data/imgs/flags/cx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/imgs/flags/cy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
data/imgs/flags/cz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

View File

@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-dk" viewBox="0 0 640 480">
<path fill="#c8102e" d="M0 0h640.1v480H0z"/>
<path fill="#fff" d="M205.7 0h68.6v480h-68.6z"/>
<path fill="#fff" d="M0 205.7h640.1v68.6H0z"/>
</svg>

Before

Width:  |  Height:  |  Size: 236 B

BIN
data/imgs/flags/de.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

View File

@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-de" viewBox="0 0 640 480">
<path fill="#ffce00" d="M0 320h640v160H0z"/>
<path d="M0 0h640v160H0z"/>
<path fill="#d00" d="M0 160h640v160H0z"/>
</svg>

Before

Width:  |  Height:  |  Size: 210 B

BIN
data/imgs/flags/dj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

BIN
data/imgs/flags/dk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

BIN
data/imgs/flags/dm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/imgs/flags/do.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

BIN
data/imgs/flags/dz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

BIN
data/imgs/flags/ec.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/imgs/flags/ee.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

BIN
data/imgs/flags/eg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

BIN
data/imgs/flags/eh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

View File

@ -1,16 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-gr" viewBox="0 0 640 480">
<path fill="#005bae" fill-rule="evenodd" stroke-width="6.7" d="M0 0h640v53.3H0z"/>
<path fill="#fff" fill-rule="evenodd" stroke-width="6.7" d="M0 53.3h640v53.4H0z"/>
<path fill="#005bae" fill-rule="evenodd" stroke-width="6.7" d="M0 106.7h640V160H0z"/>
<path fill="#fff" fill-rule="evenodd" stroke-width="6.7" d="M0 160h640v53.3H0z"/>
<path fill="#005bae" stroke-width=".9" d="M0 0h266.7v266.7H0z"/>
<path fill="#005bae" fill-rule="evenodd" stroke-width="6.7" d="M0 213.3h640v53.4H0z"/>
<path fill="#fff" fill-rule="evenodd" stroke-width="6.7" d="M0 266.7h640V320H0z"/>
<path fill="#005bae" fill-rule="evenodd" stroke-width="6.7" d="M0 320h640v53.3H0z"/>
<path fill="#fff" fill-rule="evenodd" stroke-width="6.7" d="M0 373.3h640v53.4H0z"/>
<g fill="#fff" fill-rule="evenodd" stroke-width="1.3">
<path d="M20 0h10v50H20z" transform="scale(5.33333)"/>
<path d="M0 20h50v10H0z" transform="scale(5.33333)"/>
</g>
<path fill="#005bae" stroke-width=".6" d="M0 426.7h640V480H0z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
data/imgs/flags/en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

View File

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-gb" viewBox="0 0 640 480">
<path fill="#012169" d="M0 0h640v480H0z"/>
<path fill="#FFF" d="m75 0 244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0h75z"/>
<path fill="#C8102E" d="m424 281 216 159v40L369 281h55zm-184 20 6 35L54 480H0l240-179zM640 0v3L391 191l2-44L590 0h50zM0 0l239 176h-60L0 42V0z"/>
<path fill="#FFF" d="M241 0v480h160V0H241zM0 160v160h640V160H0z"/>
<path fill="#C8102E" d="M0 193v96h640v-96H0zM273 0v480h96V0h-96z"/>
</svg>

Before

Width:  |  Height:  |  Size: 535 B

BIN
data/imgs/flags/er.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Some files were not shown because too many files have changed in this diff Show More