Fixed uncaught exception in auth and wrong example config

This commit is contained in:
Ferdinand Thiessen 2020-10-15 12:05:16 +02:00
parent 3f9fdc773c
commit e4f42006a7
3 changed files with 15 additions and 12 deletions

View File

@ -12,15 +12,6 @@ HOST =
PASSWORD =
DATABASE =
# [LDAP]
# URL =
# PORT =
# BINDDN =
# SECRET =
# USE_SSL =
## ADMIN_DN:
## ADMIN_SECRET:
[MAIL]
URL =
PORT =
@ -29,6 +20,15 @@ PASSWD =
MAIL =
CRYPT = SSL/STARTLS
#[auth_ldap]
# URL =
# PORT =
# BINDDN =
# SECRET =
# USE_SSL =
## ADMIN_DN:
## ADMIN_SECRET:
############################
# Configuration of plugins #
############################

View File

@ -42,8 +42,11 @@ def _create_token():
"""
logger.debug("Start log in.")
data = request.get_json()
userid = data['userid']
password = data['password']
try:
userid = data['userid']
password = data['password']
except KeyError:
raise BadRequest("Missing parameter(s)")
logger.debug("search user {{ {} }} in database".format(userid))
user = userController.login_user(userid, password)

View File

@ -62,7 +62,7 @@ class User(db.Model):
self.display_name = data['display_name']
def get_permissions(self):
return [permission.name for role in self.roles for permission in role.permissions]
return ["user"] + [permission.name for role in self.roles for permission in role.permissions]
def has_permissions(self, permissions):
for role in self.roles: