[balance] revert user ssp for pull-request
This commit is contained in:
parent
be1854d7c1
commit
d28130817b
|
@ -118,12 +118,8 @@ def modify_user(user, password, new_password=None):
|
|||
messageController.send_message(messageController.Message(user, text, subject))
|
||||
|
||||
|
||||
def get_users(userids=None):
|
||||
query = User.query
|
||||
if userids:
|
||||
query.filter(User.userid in userids)
|
||||
query = query.order_by(User.lastname.asc(), User.firstname.asc())
|
||||
return query.all()
|
||||
def get_users():
|
||||
return User.query.all()
|
||||
|
||||
|
||||
def get_user_by_role(role: Role):
|
||||
|
|
|
@ -104,11 +104,6 @@ class User(db.Model, ModelSerializeMixin):
|
|||
def has_permission(self, permission):
|
||||
return permission in self.get_permissions()
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f"User({self.userid}, {self.firstname}, {self.lastname}, {self.mail}, {self.display_name}, {self.birthday})"
|
||||
)
|
||||
|
||||
|
||||
class _UserAttribute(db.Model, ModelSerializeMixin):
|
||||
__tablename__ = "user_attribute"
|
||||
|
|
|
@ -110,10 +110,7 @@ def limits(current_session: Session):
|
|||
Returns:
|
||||
JSON encoded array of userid with limit or HTTP-error
|
||||
"""
|
||||
userids = None
|
||||
if "userids" in request.args:
|
||||
[x for x in request.args.get("userids").split(",") if x]
|
||||
users = userController.get_users(userids=userids)
|
||||
users = userController.get_users()
|
||||
if request.method == "GET":
|
||||
return jsonify([{"userid": user.userid, "limit": user.get_attribute("balance_limit")} for user in users])
|
||||
|
||||
|
@ -319,5 +316,8 @@ def get_balances(current_session: Session):
|
|||
sortBy = request.args.get("sortBy", type=str)
|
||||
balances, count = balance_controller.get_balances(limit=limit, offset=offset, descending=descending, sortBy=sortBy)
|
||||
return jsonify(
|
||||
{"balances": [{"userid": u, "credit": v[0], "debit": v[1]} for u, v in balances.items()], "count": count}
|
||||
{
|
||||
"balances": [{"userid": u, "credit": v[0], "debit": v[1]} for u, v in balances.items()],
|
||||
"count": count,
|
||||
}
|
||||
)
|
||||
|
|
|
@ -69,10 +69,7 @@ def list_users(current_session):
|
|||
JSON encoded array of `flaschengeist.models.user.User` or HTTP error
|
||||
"""
|
||||
logger.debug("Retrieve list of all users")
|
||||
userids = None
|
||||
if "userids" in request.args:
|
||||
userids = [x for x in request.args.get("userids").split(",") if x]
|
||||
users = userController.get_users(userids=userids)
|
||||
users = userController.get_users()
|
||||
return jsonify(users)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue