def patch(request): row = PluginConfigService.by_id(plugin_id=request.matchdict.get("id")) if not row: raise HTTPNotFound() json_body = request.unsafe_json_body if json_body["section"] == "global": row.config = json_body["config"] else: schema = UptimeConfigSchema() deserialized = schema.deserialize(json_body["config"]) row.config = deserialized return row
def __init__(self, request): Resource = appenlight.models.resource.Resource self.__acl__ = [] self.resource = None plugin_id = to_integer_safe(request.matchdict.get("id")) self.plugin = PluginConfigService.by_id(plugin_id) if not self.plugin: raise HTTPNotFound() if self.plugin.resource_id: self.resource = ResourceService.by_resource_id(self.plugin.resource_id) if self.resource: self.__acl__ = self.resource.__acl__ if request.user and self.resource: permissions = ResourceService.perms_for_user(self.resource, request.user) for perm_user, perm_name in permission_to_04_acls(permissions): self.__acl__.append(rewrite_root_perm(perm_user, perm_name)) add_root_superperm(request, self)