Flag set/get of is_public as warning ... is_public is really supposed to be only about initializing the perms ... Also add some advice about no need to temporarily add/remove visitors to the main permission for ynh_local_curl since 4.3

This commit is contained in:
Alexandre Aubin 2021-12-05 00:36:29 +01:00
parent 1a3841070d
commit e1cea41ae8

View file

@ -2062,17 +2062,24 @@ class Script(TestSuite):
@test() @test()
def set_is_public_setting(self): def set_is_public_setting(self):
if self.containsregex(r"ynh_app_setting_set .*is_public.*"): if self.containsregex(r"ynh_app_setting_set .*is_public.*"):
yield Info( yield Warning(
"permission system: it should not be needed to save is_public with ynh_app_setting_set ... this setting should only be used during installation to initialize the permission. The admin is likely to manually tweak the permission using YunoHost's interface later." "permission system: it should not be needed to save is_public with ynh_app_setting_set ... this setting should only be used during installation to initialize the permission. The admin is likely to manually tweak the permission using YunoHost's interface later."
) )
@test(ignore=["install", "_common.sh"]) @test(ignore=["install", "_common.sh"])
def get_is_public_setting(self): def get_is_public_setting(self):
if self.contains("is_public=") or self.contains("$is_public"): if self.contains("is_public=") or self.contains("$is_public"):
yield Info( yield Warning(
"permission system: there should be no need to fetch or use $is_public ... is_public should only be used during installation to initialize the permission. The admin is likely to manually tweak the permission using YunoHost's interface later." "permission system: there should be no need to fetch or use $is_public ... is_public should only be used during installation to initialize the permission. The admin is likely to manually tweak the permission using YunoHost's interface later."
) )
@test(only=["upgrade"])
def temporarily_enable_visitors_during_upgrade(self):
if self.containsregex("ynh_permission_update.*add.*visitors") and self.containsregex("ynh_permission_update.*remove.*visitors"):
yield Info(
"permission system: since Yunohost 4.3, there should be no need to temporarily add 'visitors' to the main permission. ynh_local_curl will temporarily enable visitors access if needed"
)
@test() @test()
def set_legacy_permissions(self): def set_legacy_permissions(self):
if self.containsregex( if self.containsregex(