mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix migration
This commit is contained in:
parent
414fe1926a
commit
97c3a0fb9b
2 changed files with 19 additions and 9 deletions
|
@ -73,7 +73,7 @@ depends_children:
|
|||
- permissionYnh
|
||||
groupPermission:
|
||||
- "cn=all_users,ou=groups,dc=yunohost,dc=org"
|
||||
isProtected: TRUE
|
||||
isProtected: "TRUE"
|
||||
cn=xmpp.main,ou=permission:
|
||||
cn: xmpp.main
|
||||
gidNumber: "5002"
|
||||
|
@ -82,4 +82,4 @@ depends_children:
|
|||
- permissionYnh
|
||||
groupPermission:
|
||||
- "cn=all_users,ou=groups,dc=yunohost,dc=org"
|
||||
isProtected: TRUE
|
||||
isProtected: "TRUE"
|
||||
|
|
|
@ -24,14 +24,24 @@ class MyMigration(Migration):
|
|||
def run(self):
|
||||
|
||||
from yunohost.utils.ldap import _get_ldap_interface
|
||||
from yunohost.regenconf import regen_conf, BACKUP_CONF_DIR
|
||||
|
||||
# Check if the migration can be processed
|
||||
ldap_regen_conf_status = regen_conf(names=['slapd'], dry_run=True)
|
||||
# By this we check if the have been customized
|
||||
if ldap_regen_conf_status and ldap_regen_conf_status['slapd']['pending']:
|
||||
logger.warning(m18n.n("migration_0011_slapd_config_will_be_overwritten", conf_backup_folder=BACKUP_CONF_DIR))
|
||||
|
||||
regen_conf(names=['slapd'], force=True)
|
||||
|
||||
ldap = _get_ldap_interface()
|
||||
|
||||
permission_list = user_permission_list(short=True)
|
||||
|
||||
permission_list = user_permission_list(short=True)["permissions"]
|
||||
|
||||
for permission in permission_list:
|
||||
if permission in SYSTEM_PERMS:
|
||||
ldap.update('cn=%s,ou=permission' % permission, 'isProtected': "TRUE"})
|
||||
elif permission.end_with(".main"):
|
||||
ldap.update('cn=%s,ou=permission' % permission, 'isProtected': "FALSE"})
|
||||
if permission.split('.')[0] in SYSTEM_PERMS:
|
||||
ldap.update('cn=%s,ou=permission' % permission, {'isProtected': "TRUE"})
|
||||
elif permission.endswith(".main"):
|
||||
ldap.update('cn=%s,ou=permission' % permission, {'isProtected': "FALSE"})
|
||||
else:
|
||||
ldap.update('cn=%s,ou=permission' % permission, 'isProtected': "TRUE"})
|
||||
ldap.update('cn=%s,ou=permission' % permission, {'isProtected': "TRUE"})
|
||||
|
|
Loading…
Add table
Reference in a new issue