mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
commit
fd58541cc9
6 changed files with 23 additions and 21 deletions
|
@ -3,12 +3,14 @@ addopts = -s -v
|
||||||
norecursedirs = dist doc build .tox .eggs
|
norecursedirs = dist doc build .tox .eggs
|
||||||
testpaths = tests/
|
testpaths = tests/
|
||||||
markers =
|
markers =
|
||||||
with_system_archive_from_2p4
|
with_system_archive_from_3p8
|
||||||
with_backup_recommended_app_installed
|
with_backup_recommended_app_installed
|
||||||
clean_opt_dir
|
clean_opt_dir
|
||||||
with_wordpress_archive_from_2p4
|
with_wordpress_archive_from_3p8
|
||||||
with_legacy_app_installed
|
with_legacy_app_installed
|
||||||
with_backup_recommended_app_installed_with_ynh_restore
|
with_backup_recommended_app_installed_with_ynh_restore
|
||||||
with_permission_app_installed
|
with_permission_app_installed
|
||||||
|
other_domains
|
||||||
|
with_custom_domain
|
||||||
filterwarnings =
|
filterwarnings =
|
||||||
ignore::urllib3.exceptions.InsecureRequestWarning
|
ignore::urllib3.exceptions.InsecureRequestWarning
|
|
@ -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:
|
||||||
|
@ -1263,16 +1263,15 @@ def app_remove(operation_logger, app):
|
||||||
else:
|
else:
|
||||||
logger.warning(m18n.n("app_not_properly_removed", app=app))
|
logger.warning(m18n.n("app_not_properly_removed", app=app))
|
||||||
|
|
||||||
|
# Remove all permission in LDAP
|
||||||
|
for permission_name in user_permission_list(apps=[app])["permissions"].keys():
|
||||||
|
permission_delete(permission_name, force=True, sync_perm=False)
|
||||||
|
|
||||||
if os.path.exists(app_setting_path):
|
if os.path.exists(app_setting_path):
|
||||||
shutil.rmtree(app_setting_path)
|
shutil.rmtree(app_setting_path)
|
||||||
shutil.rmtree("/tmp/yunohost_remove")
|
shutil.rmtree("/tmp/yunohost_remove")
|
||||||
hook_remove(app)
|
hook_remove(app)
|
||||||
|
|
||||||
# Remove all permission in LDAP
|
|
||||||
for permission_name in user_permission_list()["permissions"].keys():
|
|
||||||
if permission_name.startswith(app + "."):
|
|
||||||
permission_delete(permission_name, force=True, sync_perm=False)
|
|
||||||
|
|
||||||
permission_sync_to_user()
|
permission_sync_to_user()
|
||||||
_assert_system_is_sane_for_app(manifest, "post")
|
_assert_system_is_sane_for_app(manifest, "post")
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -340,9 +340,9 @@ def is_unit_operation(
|
||||||
# Indeed, we use convention naming in this decorator and we need to
|
# Indeed, we use convention naming in this decorator and we need to
|
||||||
# know name of each args (so we need to use kwargs instead of args)
|
# know name of each args (so we need to use kwargs instead of args)
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
from inspect import getargspec
|
from inspect import signature
|
||||||
|
|
||||||
keys = getargspec(func).args
|
keys = list(signature(func).parameters.keys())
|
||||||
if "operation_logger" in keys:
|
if "operation_logger" in keys:
|
||||||
keys.remove("operation_logger")
|
keys.remove("operation_logger")
|
||||||
for k, arg in enumerate(args):
|
for k, arg in enumerate(args):
|
||||||
|
|
|
@ -74,13 +74,13 @@ def user_permission_list(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Parse / organize information to be outputed
|
# Parse / organize information to be outputed
|
||||||
if apps:
|
installed_apps = sorted(_installed_apps())
|
||||||
ignore_system_perms = True
|
filter_ = apps
|
||||||
apps = apps if apps else sorted(_installed_apps())
|
apps = filter_ if filter_ else installed_apps
|
||||||
apps_base_path = {
|
apps_base_path = {
|
||||||
app: app_setting(app, "domain") + app_setting(app, "path")
|
app: app_setting(app, "domain") + app_setting(app, "path")
|
||||||
for app in apps
|
for app in apps
|
||||||
if app_setting(app, "domain") and app_setting(app, "path")
|
if app in installed_apps and app_setting(app, "domain") and app_setting(app, "path")
|
||||||
}
|
}
|
||||||
|
|
||||||
permissions = {}
|
permissions = {}
|
||||||
|
@ -89,10 +89,9 @@ def user_permission_list(
|
||||||
name = infos["cn"][0]
|
name = infos["cn"][0]
|
||||||
app = name.split(".")[0]
|
app = name.split(".")[0]
|
||||||
|
|
||||||
if app in SYSTEM_PERMS:
|
if ignore_system_perms and app in SYSTEM_PERMS:
|
||||||
if ignore_system_perms:
|
continue
|
||||||
continue
|
if filter_ and app not in apps:
|
||||||
elif app not in apps:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
perm = {}
|
perm = {}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import glob
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from yunohost.utils.error import YunohostError
|
from yunohost.utils.error import YunohostError
|
||||||
|
@ -28,6 +29,8 @@ def setup_function(function):
|
||||||
|
|
||||||
def teardown_function(function):
|
def teardown_function(function):
|
||||||
os.system("mv /etc/yunohost/settings.json.saved /etc/yunohost/settings.json")
|
os.system("mv /etc/yunohost/settings.json.saved /etc/yunohost/settings.json")
|
||||||
|
for filename in glob.glob("/etc/yunohost/settings-*.json"):
|
||||||
|
os.remove(filename)
|
||||||
|
|
||||||
|
|
||||||
def test_settings_get_bool():
|
def test_settings_get_bool():
|
||||||
|
|
Loading…
Add table
Reference in a new issue