mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Simplify(?) migration code
This commit is contained in:
parent
4e40f8b86a
commit
db14d73e11
1 changed files with 16 additions and 29 deletions
|
@ -39,50 +39,37 @@ class MyMigration(Migration):
|
||||||
permission_list = user_permission_list(full=True)["permissions"]
|
permission_list = user_permission_list(full=True)["permissions"]
|
||||||
|
|
||||||
for permission in permission_list:
|
for permission in permission_list:
|
||||||
if permission.split('.')[0] == 'mail':
|
system_perms = {
|
||||||
ldap.update('cn=%s,ou=permission' % permission, {
|
"mail": "E-mail",
|
||||||
|
"xmpp": "XMPP",
|
||||||
|
"ssh": "SSH",
|
||||||
|
"sftp": "STFP"
|
||||||
|
}
|
||||||
|
if permission.split('.')[0] in system_perms:
|
||||||
|
update = {
|
||||||
'authHeader': ["FALSE"],
|
'authHeader': ["FALSE"],
|
||||||
'label': ['E-mail'],
|
'label': [system_perms[permission.split('.')[0]]],
|
||||||
'showTile': ["FALSE"],
|
'showTile': ["FALSE"],
|
||||||
'isProtected': ["TRUE"],
|
'isProtected': ["TRUE"],
|
||||||
})
|
}
|
||||||
elif permission.split('.')[0] == 'xmpp':
|
|
||||||
ldap.update('cn=%s,ou=permission' % permission, {
|
|
||||||
'authHeader': ["FALSE"],
|
|
||||||
'label': ['XMPP'],
|
|
||||||
'showTile': ["FALSE"],
|
|
||||||
'isProtected': ["TRUE"],
|
|
||||||
})
|
|
||||||
elif permission.split('.')[0] == 'ssh':
|
|
||||||
ldap.update('cn=%s,ou=permission' % permission, {
|
|
||||||
'authHeader': ["FALSE"],
|
|
||||||
'label': ['SSH'],
|
|
||||||
'showTile': ["FALSE"],
|
|
||||||
'isProtected': ["TRUE"],
|
|
||||||
})
|
|
||||||
elif permission.split('.')[0] == 'sftp':
|
|
||||||
ldap.update('cn=%s,ou=permission' % permission, {
|
|
||||||
'authHeader': ["FALSE"],
|
|
||||||
'label': ['SFTP'],
|
|
||||||
'showTile': ["FALSE"],
|
|
||||||
'isProtected': ["TRUE"],
|
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
app, subperm_name = permission.split('.')
|
app, subperm_name = permission.split('.')
|
||||||
if permission.endswith(".main"):
|
if permission.endswith(".main"):
|
||||||
ldap.update('cn=%s,ou=permission' % permission, {
|
update = {
|
||||||
'authHeader': ["TRUE"],
|
'authHeader': ["TRUE"],
|
||||||
'label': [app], # Note that this is later re-changed during the call to migrate_legacy_permission_settings() if a 'label' setting exists
|
'label': [app], # Note that this is later re-changed during the call to migrate_legacy_permission_settings() if a 'label' setting exists
|
||||||
'showTile': ["TRUE"],
|
'showTile': ["TRUE"],
|
||||||
'isProtected': ["FALSE"]
|
'isProtected': ["FALSE"]
|
||||||
})
|
}
|
||||||
else:
|
else:
|
||||||
ldap.update('cn=%s,ou=permission' % permission, {
|
update = {
|
||||||
'authHeader': ["TRUE"],
|
'authHeader': ["TRUE"],
|
||||||
'label': [subperm_name.title()],
|
'label': [subperm_name.title()],
|
||||||
'showTile': ["FALSE"],
|
'showTile': ["FALSE"],
|
||||||
'isProtected': ["TRUE"]
|
'isProtected': ["TRUE"]
|
||||||
})
|
}
|
||||||
|
|
||||||
|
ldap.update('cn=%s,ou=permission' % permission, update)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue