mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
appsv2: fix usage of __DOMAIN__ in permission url
This commit is contained in:
parent
139e54a2e5
commit
943b9ff89f
1 changed files with 5 additions and 3 deletions
|
@ -153,9 +153,6 @@ class AppResource:
|
|||
for key, value in properties.items():
|
||||
if isinstance(value, str):
|
||||
value = value.replace("__APP__", self.app)
|
||||
# This one is needed for custom permission urls where the domain might be used
|
||||
if "__DOMAIN__" in value:
|
||||
value.replace("__DOMAIN__", self.get_setting("domain"))
|
||||
setattr(self, key, value)
|
||||
|
||||
def get_setting(self, key):
|
||||
|
@ -340,6 +337,11 @@ class PermissionsResource(AppResource):
|
|||
|
||||
super().__init__({"permissions": properties}, *args, **kwargs)
|
||||
|
||||
for perm, infos in self.permissions.items():
|
||||
if "__DOMAIN__" in infos.get("url", ""):
|
||||
infos["url"] = infos["url"].replace("__DOMAIN__", self.get_setting("domain"))
|
||||
infos["additional_urls"] = [u.replace("__DOMAIN__", self.get_setting("domain")) for u in infos.get("additional_urls")]
|
||||
|
||||
def provision_or_update(self, context: Dict = {}):
|
||||
from yunohost.permission import (
|
||||
permission_create,
|
||||
|
|
Loading…
Add table
Reference in a new issue