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
|
||||
testpaths = tests/
|
||||
markers =
|
||||
with_system_archive_from_2p4
|
||||
with_system_archive_from_3p8
|
||||
with_backup_recommended_app_installed
|
||||
clean_opt_dir
|
||||
with_wordpress_archive_from_2p4
|
||||
with_wordpress_archive_from_3p8
|
||||
with_legacy_app_installed
|
||||
with_backup_recommended_app_installed_with_ynh_restore
|
||||
with_permission_app_installed
|
||||
other_domains
|
||||
with_custom_domain
|
||||
filterwarnings =
|
||||
ignore::urllib3.exceptions.InsecureRequestWarning
|
|
@ -324,9 +324,9 @@ def app_map(app=None, raw=False, user=None):
|
|||
app,
|
||||
]
|
||||
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:
|
||||
app_settings = _get_app_settings(app_id)
|
||||
if not app_settings:
|
||||
|
@ -1263,16 +1263,15 @@ def app_remove(operation_logger, app):
|
|||
else:
|
||||
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):
|
||||
shutil.rmtree(app_setting_path)
|
||||
shutil.rmtree("/tmp/yunohost_remove")
|
||||
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()
|
||||
_assert_system_is_sane_for_app(manifest, "post")
|
||||
|
||||
|
|
|
@ -726,11 +726,10 @@ class BackupManager:
|
|||
|
||||
# backup permissions
|
||||
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 = {
|
||||
name: infos
|
||||
for name, infos in permissions.items()
|
||||
if name.startswith(app + ".")
|
||||
}
|
||||
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
|
||||
# know name of each args (so we need to use kwargs instead of args)
|
||||
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:
|
||||
keys.remove("operation_logger")
|
||||
for k, arg in enumerate(args):
|
||||
|
|
|
@ -74,13 +74,13 @@ def user_permission_list(
|
|||
)
|
||||
|
||||
# Parse / organize information to be outputed
|
||||
if apps:
|
||||
ignore_system_perms = True
|
||||
apps = apps if apps else sorted(_installed_apps())
|
||||
installed_apps = sorted(_installed_apps())
|
||||
filter_ = apps
|
||||
apps = filter_ if filter_ else installed_apps
|
||||
apps_base_path = {
|
||||
app: app_setting(app, "domain") + app_setting(app, "path")
|
||||
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 = {}
|
||||
|
@ -89,10 +89,9 @@ def user_permission_list(
|
|||
name = infos["cn"][0]
|
||||
app = name.split(".")[0]
|
||||
|
||||
if app in SYSTEM_PERMS:
|
||||
if ignore_system_perms:
|
||||
continue
|
||||
elif app not in apps:
|
||||
if ignore_system_perms and app in SYSTEM_PERMS:
|
||||
continue
|
||||
if filter_ and app not in apps:
|
||||
continue
|
||||
|
||||
perm = {}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
import json
|
||||
import glob
|
||||
import pytest
|
||||
|
||||
from yunohost.utils.error import YunohostError
|
||||
|
@ -28,6 +29,8 @@ def setup_function(function):
|
|||
|
||||
def teardown_function(function):
|
||||
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():
|
||||
|
|
Loading…
Add table
Reference in a new issue