mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[ADD] base_ical
This commit is contained in:
committed by
fkantelberg
parent
35dbc22d7e
commit
1e6b6ceda7
1
base_ical/controllers/__init__.py
Normal file
1
base_ical/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import main
|
||||
27
base_ical/controllers/main.py
Normal file
27
base_ical/controllers/main.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright 2023 Hunki Enterprises BV
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)
|
||||
|
||||
|
||||
from odoo import http
|
||||
|
||||
|
||||
class MyController(http.Controller):
|
||||
@http.route(
|
||||
"/base_ical/<string:token>",
|
||||
auth="public",
|
||||
csrf=False,
|
||||
methods=["GET"],
|
||||
type="http",
|
||||
)
|
||||
def get_ical(self, token):
|
||||
# TODO: respect if-modified-since headers
|
||||
token = (
|
||||
http.request.env["base.ical.token"].sudo().search([("token", "=", token)])
|
||||
)
|
||||
if not token:
|
||||
return http.request.not_found()
|
||||
response = http.request.make_response(
|
||||
token.ical_id.with_user(token.user_id)._get_ical(),
|
||||
headers={"content-type": "text/calendar"},
|
||||
)
|
||||
return response
|
||||
Reference in New Issue
Block a user