mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Group-permission migration - integrate all function in migration class
This commit is contained in:
parent
3c1c32e08b
commit
bc0435b9c4
1 changed files with 62 additions and 62 deletions
|
@ -20,8 +20,17 @@ logger = getActionLogger('yunohost.migration')
|
|||
# Tools used also for restoration
|
||||
###################################################
|
||||
|
||||
class MyMigration(Migration):
|
||||
"""
|
||||
Update the LDAP DB to be able to store the permission
|
||||
Create a group for each yunohost user
|
||||
Migrate app permission from apps setting to LDAP
|
||||
"""
|
||||
|
||||
def migrate_LDAP_db(auth):
|
||||
required = True
|
||||
|
||||
def migrate_LDAP_db(self, auth):
|
||||
print("asdfadsf")
|
||||
logger.info(m18n.n("migration_0011_update_LDAP_database"))
|
||||
try:
|
||||
auth.remove('cn=sftpusers,ou=groups')
|
||||
|
@ -58,7 +67,7 @@ def migrate_LDAP_db(auth):
|
|||
user_group_update(auth, groupname='all_users', add_user=username, force=True, sync_perm=False)
|
||||
|
||||
|
||||
def migrate_app_permission(auth, app=None):
|
||||
def migrate_app_permission(self, auth, app=None):
|
||||
logger.info(m18n.n("migration_0011_migrate_permission"))
|
||||
|
||||
if app:
|
||||
|
@ -80,15 +89,6 @@ def migrate_app_permission(auth, app=None):
|
|||
app_setting(app, 'allowed_users', delete=True)
|
||||
|
||||
|
||||
class MyMigration(Migration):
|
||||
"""
|
||||
Update the LDAP DB to be able to store the permission
|
||||
Create a group for each yunohost user
|
||||
Migrate app permission from apps setting to LDAP
|
||||
"""
|
||||
|
||||
required = True
|
||||
|
||||
def migrate(self):
|
||||
# Check if the migration can be processed
|
||||
ldap_regen_conf_status = regen_conf(names=['slapd'], dry_run=True)
|
||||
|
@ -123,10 +123,10 @@ class MyMigration(Migration):
|
|||
auth = init_authenticator(AUTH_IDENTIFIER, AUTH_PARAMETERS)
|
||||
|
||||
# Update LDAP database
|
||||
migrate_LDAP_db(auth)
|
||||
self.migrate_LDAP_db(auth)
|
||||
|
||||
# Migrate permission
|
||||
migrate_app_permission(auth)
|
||||
self.migrate_app_permission(auth)
|
||||
|
||||
permission_sync_to_user(auth)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Add table
Reference in a new issue