models.user: get_accounts(): order by name

The order of account names returned by User.get_accounts() affects the
order account names are displyed in on /domain/add if the current user
neither has the Administrator role nor the Operator role and the
`allow_user_create_domain` setting is enabled at the same time.

If the current user does have the Administrator or Operator role,
routes.domain.add() already returns accounts ordered by name, so this
change makes it consistent.
This commit is contained in:
Dominic Zöller 2021-11-19 16:55:29 +01:00 committed by zoeller-freinet
parent 51a7f636b0
commit 6f12b783a8

View File

@ -628,6 +628,7 @@ class User(db.Model):
Account)\
.filter(self.id == AccountUser.user_id)\
.filter(Account.id == AccountUser.account_id)\
.order_by(Account.name)\
.all()
for q in query:
accounts.append(q[1])