mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Friskies m0ar
This commit is contained in:
parent
ae73e94c3e
commit
d7067c0b22
3 changed files with 2 additions and 18 deletions
|
@ -37,22 +37,6 @@ class MyMigration(Migration):
|
||||||
new_admin_user = user
|
new_admin_user = user
|
||||||
break
|
break
|
||||||
|
|
||||||
# NB: we handle the edge-case where no user exist at all
|
|
||||||
# which is useful for the CI etc.
|
|
||||||
if all_users and not new_admin_user:
|
|
||||||
new_admin_user = os.environ.get("YNH_NEW_ADMIN_USER")
|
|
||||||
if new_admin_user:
|
|
||||||
assert new_admin_user in all_users, f"{new_admin_user} is not an existing yunohost user"
|
|
||||||
else:
|
|
||||||
raise YunohostError(
|
|
||||||
# FIXME: i18n
|
|
||||||
"""The very first user created on this Yunohost instance could not be found, and therefore this migration can not be ran. You should re-run this migration as soon as possible from the command line with, after choosing which user should become the admin:
|
|
||||||
|
|
||||||
export YNH_NEW_ADMIN_USER=some_existing_username
|
|
||||||
yunohost tools migrations run""",
|
|
||||||
raw_msg=True
|
|
||||||
)
|
|
||||||
|
|
||||||
self.ldap_migration_started = True
|
self.ldap_migration_started = True
|
||||||
|
|
||||||
if new_admin_user:
|
if new_admin_user:
|
||||||
|
|
|
@ -109,7 +109,7 @@ def clean_user_groups_permission():
|
||||||
user_delete(u)
|
user_delete(u)
|
||||||
|
|
||||||
for g in user_group_list()["groups"]:
|
for g in user_group_list()["groups"]:
|
||||||
if g not in ["all_users", "visitors"]:
|
if g not in ["all_users", "visitors", "admins"]:
|
||||||
user_group_delete(g)
|
user_group_delete(g)
|
||||||
|
|
||||||
for p in user_permission_list()["permissions"]:
|
for p in user_permission_list()["permissions"]:
|
||||||
|
|
|
@ -56,7 +56,7 @@ FIELDS_FOR_IMPORT = {
|
||||||
"groups": r"^|([a-z0-9_]+(,?[a-z0-9_]+)*)$",
|
"groups": r"^|([a-z0-9_]+(,?[a-z0-9_]+)*)$",
|
||||||
}
|
}
|
||||||
|
|
||||||
ADMIN_ALIASES = ["root@", "admin@", "webmaster@", "postmaster@", "abuse@"]
|
ADMIN_ALIASES = ["root@", "admin@", "admins", "webmaster@", "postmaster@", "abuse@"]
|
||||||
|
|
||||||
|
|
||||||
def user_list(fields=None):
|
def user_list(fields=None):
|
||||||
|
|
Loading…
Add table
Reference in a new issue