Sidewards compatibility with pluginify. Some cleanup
This commit is contained in:
parent
07a0d266a6
commit
5cd752a096
|
@ -227,7 +227,7 @@ class User():
|
||||||
"dn": self.dn,
|
"dn": self.dn,
|
||||||
"firstname": self.firstname,
|
"firstname": self.firstname,
|
||||||
"lastname": self.lastname,
|
"lastname": self.lastname,
|
||||||
"group": self.group,
|
"groups": self.group,
|
||||||
"username": self.uid,
|
"username": self.uid,
|
||||||
"locked": self.locked,
|
"locked": self.locked,
|
||||||
"autoLock": self.autoLock,
|
"autoLock": self.autoLock,
|
||||||
|
|
|
@ -216,16 +216,16 @@ def _getUsers(**kwargs):
|
||||||
return jsonify({"error": str(err)}), 500
|
return jsonify({"error": str(err)}), 500
|
||||||
|
|
||||||
|
|
||||||
@app.route("/getLifeTime", methods=['GET'])
|
@app.route("/getLifetime", methods=['GET'])
|
||||||
@login_required(groups=[MONEY, GASTRO, VORSTAND, EXTERN, USER], bar=True)
|
@login_required(groups=[MONEY, GASTRO, VORSTAND, EXTERN, USER], bar=True)
|
||||||
def _getLifeTime(**kwargs):
|
def _getLifetime(**kwargs):
|
||||||
try:
|
try:
|
||||||
debug.info("get lifetime of accesstoken")
|
debug.info("get lifetime of accesstoken")
|
||||||
if 'accToken' in kwargs:
|
if 'accToken' in kwargs:
|
||||||
accToken = kwargs['accToken']
|
accToken = kwargs['accToken']
|
||||||
debug.debug("accessToken is {{ {} }}".format(accToken))
|
debug.debug("accessToken is {{ {} }}".format(accToken))
|
||||||
retVal = {"value": accToken.lifetime,
|
retVal = {"value": accToken.lifetime,
|
||||||
"group": accToken.user.toJSON()['group'],
|
"groups": accToken.user.toJSON()['groups'],
|
||||||
"lock_bar": accToken.lock_bar}
|
"lock_bar": accToken.lock_bar}
|
||||||
debug.info(
|
debug.info(
|
||||||
"return get lifetime from accesstoken {{ {} }}".format(retVal))
|
"return get lifetime from accesstoken {{ {} }}".format(retVal))
|
||||||
|
@ -235,11 +235,11 @@ def _getLifeTime(**kwargs):
|
||||||
return jsonify({"error": str(err)}), 500
|
return jsonify({"error": str(err)}), 500
|
||||||
|
|
||||||
|
|
||||||
@app.route("/saveLifeTime", methods=['POST'])
|
@app.route("/setLifetime", methods=['POST'])
|
||||||
@login_required(groups=[MONEY, GASTRO, VORSTAND, EXTERN, USER], bar=True)
|
@login_required(groups=[MONEY, GASTRO, VORSTAND, EXTERN, USER], bar=True)
|
||||||
def _saveLifeTime(**kwargs):
|
def _setLifetime(**kwargs):
|
||||||
try:
|
try:
|
||||||
debug.info("save lifetime for accessToken")
|
debug.info("set lifetime for accessToken")
|
||||||
if 'accToken' in kwargs:
|
if 'accToken' in kwargs:
|
||||||
accToken = kwargs['accToken']
|
accToken = kwargs['accToken']
|
||||||
debug.debug("accessToken is {{ {} }}".format(accToken))
|
debug.debug("accessToken is {{ {} }}".format(accToken))
|
||||||
|
@ -253,7 +253,7 @@ def _saveLifeTime(**kwargs):
|
||||||
accToken = accesTokenController.updateAccessToken(accToken)
|
accToken = accesTokenController.updateAccessToken(accToken)
|
||||||
accToken = accesTokenController.validateAccessToken(accToken.token, [USER, EXTERN])
|
accToken = accesTokenController.validateAccessToken(accToken.token, [USER, EXTERN])
|
||||||
retVal = {"value": accToken.lifetime,
|
retVal = {"value": accToken.lifetime,
|
||||||
"group": accToken.user.toJSON()['group']}
|
"groups": accToken.user.toJSON()['groups']}
|
||||||
debug.info(
|
debug.info(
|
||||||
"return save lifetime for accessToken {{ {} }}".format(retVal))
|
"return save lifetime for accessToken {{ {} }}".format(retVal))
|
||||||
return jsonify(retVal)
|
return jsonify(retVal)
|
||||||
|
@ -320,7 +320,6 @@ def _login():
|
||||||
debug.info("validate accesstoken")
|
debug.info("validate accesstoken")
|
||||||
dic = accesTokenController.validateAccessToken(
|
dic = accesTokenController.validateAccessToken(
|
||||||
token, [USER, EXTERN]).user.toJSON()
|
token, [USER, EXTERN]).user.toJSON()
|
||||||
dic["token"] = token
|
|
||||||
dic["accessToken"] = token
|
dic["accessToken"] = token
|
||||||
debug.info("User {{ {} }} success login.".format(username))
|
debug.info("User {{ {} }} success login.".format(username))
|
||||||
debug.info("return login {{ {} }}".format(dic))
|
debug.info("return login {{ {} }}".format(dic))
|
||||||
|
|
Loading…
Reference in New Issue