Fixed uncaught exception in auth and wrong example config
This commit is contained in:
parent
3f9fdc773c
commit
e4f42006a7
|
@ -12,15 +12,6 @@ HOST =
|
||||||
PASSWORD =
|
PASSWORD =
|
||||||
DATABASE =
|
DATABASE =
|
||||||
|
|
||||||
# [LDAP]
|
|
||||||
# URL =
|
|
||||||
# PORT =
|
|
||||||
# BINDDN =
|
|
||||||
# SECRET =
|
|
||||||
# USE_SSL =
|
|
||||||
## ADMIN_DN:
|
|
||||||
## ADMIN_SECRET:
|
|
||||||
|
|
||||||
[MAIL]
|
[MAIL]
|
||||||
URL =
|
URL =
|
||||||
PORT =
|
PORT =
|
||||||
|
@ -29,6 +20,15 @@ PASSWD =
|
||||||
MAIL =
|
MAIL =
|
||||||
CRYPT = SSL/STARTLS
|
CRYPT = SSL/STARTLS
|
||||||
|
|
||||||
|
#[auth_ldap]
|
||||||
|
# URL =
|
||||||
|
# PORT =
|
||||||
|
# BINDDN =
|
||||||
|
# SECRET =
|
||||||
|
# USE_SSL =
|
||||||
|
## ADMIN_DN:
|
||||||
|
## ADMIN_SECRET:
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Configuration of plugins #
|
# Configuration of plugins #
|
||||||
############################
|
############################
|
||||||
|
|
|
@ -42,8 +42,11 @@ def _create_token():
|
||||||
"""
|
"""
|
||||||
logger.debug("Start log in.")
|
logger.debug("Start log in.")
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
userid = data['userid']
|
try:
|
||||||
password = data['password']
|
userid = data['userid']
|
||||||
|
password = data['password']
|
||||||
|
except KeyError:
|
||||||
|
raise BadRequest("Missing parameter(s)")
|
||||||
|
|
||||||
logger.debug("search user {{ {} }} in database".format(userid))
|
logger.debug("search user {{ {} }} in database".format(userid))
|
||||||
user = userController.login_user(userid, password)
|
user = userController.login_user(userid, password)
|
||||||
|
|
|
@ -62,7 +62,7 @@ class User(db.Model):
|
||||||
self.display_name = data['display_name']
|
self.display_name = data['display_name']
|
||||||
|
|
||||||
def get_permissions(self):
|
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):
|
def has_permissions(self, permissions):
|
||||||
for role in self.roles:
|
for role in self.roles:
|
||||||
|
|
Loading…
Reference in New Issue