mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
user_permission_list: use the new apps arg when we can
This commit is contained in:
parent
bd72a59e1f
commit
f6687e69f8
2 changed files with 7 additions and 10 deletions
|
@ -324,9 +324,9 @@ def app_map(app=None, raw=False, user=None):
|
||||||
app,
|
app,
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
apps = os.listdir(APPS_SETTING_PATH)
|
apps = _installed_apps()
|
||||||
|
|
||||||
permissions = user_permission_list(full=True, absolute_urls=True)["permissions"]
|
permissions = user_permission_list(full=True, absolute_urls=True, apps=apps)["permissions"]
|
||||||
for app_id in apps:
|
for app_id in apps:
|
||||||
app_settings = _get_app_settings(app_id)
|
app_settings = _get_app_settings(app_id)
|
||||||
if not app_settings:
|
if not app_settings:
|
||||||
|
@ -1096,9 +1096,8 @@ def app_install(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Remove all permission in LDAP
|
# Remove all permission in LDAP
|
||||||
for permission_name in user_permission_list()["permissions"].keys():
|
for permission_name in user_permission_list(apps=[app_instance_name])["permissions"].keys():
|
||||||
if permission_name.startswith(app_instance_name + "."):
|
permission_delete(permission_name, force=True, sync_perm=False)
|
||||||
permission_delete(permission_name, force=True, sync_perm=False)
|
|
||||||
|
|
||||||
if remove_retcode != 0:
|
if remove_retcode != 0:
|
||||||
msg = m18n.n("app_not_properly_removed", app=app_instance_name)
|
msg = m18n.n("app_not_properly_removed", app=app_instance_name)
|
||||||
|
|
|
@ -726,11 +726,10 @@ class BackupManager:
|
||||||
|
|
||||||
# backup permissions
|
# backup permissions
|
||||||
logger.debug(m18n.n("backup_permission", app=app))
|
logger.debug(m18n.n("backup_permission", app=app))
|
||||||
permissions = user_permission_list(full=True)["permissions"]
|
permissions = user_permission_list(full=True, apps=[app])["permissions"]
|
||||||
this_app_permissions = {
|
this_app_permissions = {
|
||||||
name: infos
|
name: infos
|
||||||
for name, infos in permissions.items()
|
for name, infos in permissions.items()
|
||||||
if name.startswith(app + ".")
|
|
||||||
}
|
}
|
||||||
write_to_yaml("%s/permissions.yml" % settings_dir, this_app_permissions)
|
write_to_yaml("%s/permissions.yml" % settings_dir, this_app_permissions)
|
||||||
|
|
||||||
|
@ -1547,9 +1546,8 @@ class RestoreManager:
|
||||||
shutil.rmtree(app_settings_new_path, ignore_errors=True)
|
shutil.rmtree(app_settings_new_path, ignore_errors=True)
|
||||||
|
|
||||||
# Remove all permission in LDAP for this app
|
# Remove all permission in LDAP for this app
|
||||||
for permission_name in user_permission_list()["permissions"].keys():
|
for permission_name in user_permission_list(apps=[app_instance_name])["permissions"].keys():
|
||||||
if permission_name.startswith(app_instance_name + "."):
|
permission_delete(permission_name, force=True)
|
||||||
permission_delete(permission_name, force=True)
|
|
||||||
|
|
||||||
# TODO Cleaning app hooks
|
# TODO Cleaning app hooks
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue