forked from OCA/calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
[ADD] calendar_shared_ics #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ntsirintanis
wants to merge
5
commits into
16.0
Choose a base branch
from
16.0-calendar_shared_ics
base: 16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
12286f4
[ADD] calendar_shared_ics
ntsirintanis 36d9214
[ADD] landing page, README, tests
ntsirintanis 2e12853
[ADD] more tests, more event filtering, more security, readme
ntsirintanis ae43446
fixup! [ADD] more tests, more event filtering, more security, readme
ntsirintanis a1e8e42
fixup! fixup! [ADD] more tests, more event filtering, more security, …
ntsirintanis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,201 @@ | ||
| ====================================== | ||
| Shared ICS calendars (token-protected) | ||
| ====================================== | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:490396883f2f27e9e987064ece49696f3e0dcc53e355b186debb2d5c642e61f3 | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
| :target: https://odoo-community.org/page/development-status | ||
| :alt: Beta | ||
| .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
| :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
| .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcalendar-lightgray.png?logo=github | ||
| :target: https://github.com/OCA/calendar/tree/16.0/calendar_shared_ics | ||
| :alt: OCA/calendar | ||
| .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
| :target: https://translation.odoo-community.org/projects/calendar-16-0/calendar-16-0-calendar_shared_ics | ||
| :alt: Translate me on Weblate | ||
| .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
| :target: https://runboat.odoo-community.org/builds?repo=OCA/calendar&target_branch=16.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| This module allows sharing an Odoo calendar as a read-only ICS feed that can be | ||
| subscribed to in external calendar clients such as Outlook, Google Calendar, | ||
| and Thunderbird. | ||
|
|
||
| The calendar is exposed via a public URL protected by an access token and can be | ||
| added as a network calendar (ICS / ``webcal://``). External calendar clients periodically | ||
| refresh the feed, providing near-real-time visibility of Odoo events without any | ||
| write-back capability. | ||
|
|
||
| Odoo includes bidirectional calendar synchronisation with external providers such as | ||
| Outlook and Google Calendar. In practice, however, this integration is not always | ||
| sufficiently robust and can suffer from functional limitations, data inconsistencies, | ||
| or bugs—especially in environments with complex recurrence rules, shared resources, | ||
| or high event volumes. | ||
|
|
||
| This module provides a simple, reliable, and intentionally one-directional | ||
| alternative: | ||
|
|
||
| * Events are exported from Odoo as a **read-only ICS calendar** | ||
| * External clients periodically fetch the feed | ||
| * No changes are ever written back into Odoo | ||
| * Old events can be excluded by default to improve synchronisation performance | ||
|
|
||
| Typical use cases include: | ||
|
|
||
| * Sharing planning or resource bookings with internal employees | ||
| * Providing customers or partners with insight into scheduled events | ||
| * Publishing operational calendars without exposing the Odoo backend | ||
| * Avoiding conflicts or data corruption caused by two-way synchronisation | ||
|
|
||
| Each shared calendar feed can be configured individually, including: | ||
|
|
||
| * Restricting events to a specific attendee (partner) | ||
| * Applying additional custom event filters | ||
| * Limiting exports to recent and future events only | ||
| * Generating and rotating access tokens | ||
| * Sharing the feed via the standard Odoo portal share wizard | ||
|
|
||
| **Security notice** | ||
|
|
||
| The calendar feed is protected solely by an **access token embedded in the URL**. | ||
| Anyone in possession of this URL can view the calendar contents. | ||
|
|
||
| The token grants **read-only access** and does **not** allow modification of data or | ||
| configuration of the feed. Nevertheless, the URL should be treated as confidential and | ||
| shared only with trusted recipients. | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
|
|
||
| Only users with the *Shared ICS manager* role can create or modify | ||
| shared calendar feeds. | ||
|
|
||
| #. Go to *Calendar → Configuration → Shared ICS* | ||
| #. Create a new *Shared ICS calendar* | ||
| #. Configure the feed: | ||
|
|
||
| * Select the **partner** whose events should be exported | ||
| * Optionally restrict events further using **Additional Filtering** | ||
| * Optionally limit the feed to **recent and future events only** | ||
| * Adjust user-related filters to easily select internal or portal users | ||
|
|
||
| Each record represents one independent, read-only calendar feed. | ||
|
|
||
| Regular users can only **view their own feed** (if any) but cannot | ||
| create, modify, or delete shared calendars. | ||
|
|
||
| Generate a share link | ||
|
|
||
| #. Open the shared calendar feed record | ||
| #. Click **Share** | ||
| #. The standard Odoo *Share* wizard will open | ||
| #. Select one or more recipients and send the email | ||
|
|
||
| The email contains a link to a landing page where the recipient can | ||
| copy the actual subscription URL. | ||
|
|
||
| Subscribe from an external calendar | ||
|
|
||
| #. Open the link from the email | ||
| #. Copy either the **``webcal://``** or **``https://``** URL shown on the page | ||
| #. Add it as a network / public calendar in your calendar client | ||
|
|
||
| Examples: | ||
|
|
||
| * **Outlook** | ||
|
|
||
| *Add calendar → Subscribe from web* | ||
|
|
||
| * **Google Calendar** | ||
|
|
||
| *Settings → Add calendar → From URL* | ||
|
|
||
| * **Thunderbird** | ||
|
|
||
| *New Calendar → On the Network → iCalendar (ICS)* | ||
|
|
||
| The external calendar will periodically refresh the feed. | ||
| All events are **read-only** and cannot be modified from the external client. | ||
|
|
||
| Rotate access token (optional) | ||
|
|
||
| If a subscription URL is compromised: | ||
|
|
||
| #. Open the shared calendar feed | ||
| #. Click **Rotate access token** | ||
| #. A new token is generated immediately | ||
|
|
||
| All previously issued URLs stop working at once, while the new URL | ||
| continues to function without further configuration. | ||
|
|
||
| Known issues / Roadmap | ||
| ====================== | ||
|
|
||
| * Optional **IP restriction** for shared calendar feeds | ||
| * Optional **expiration date** for access tokens | ||
| * Per-feed refresh hints / cache control options | ||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/calendar/issues>`_. | ||
| In case of trouble, please check there if your issue has already been reported. | ||
| If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
| `feedback <https://github.com/OCA/calendar/issues/new?body=module:%20calendar_shared_ics%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
| Do not contact contributors directly about support or help with technical issues. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ~~~~~~~ | ||
|
|
||
| * Therp BV | ||
|
|
||
| Contributors | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| * Nikos Tsirintanis <ntsirintanis@therp.nl> | ||
|
|
||
| Maintainers | ||
| ~~~~~~~~~~~ | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
| mission is to support the collaborative development of Odoo features and | ||
| promote its widespread use. | ||
|
|
||
| .. |maintainer-ntsirintanis| image:: https://github.com/ntsirintanis.png?size=40px | ||
| :target: https://github.com/ntsirintanis | ||
| :alt: ntsirintanis | ||
|
|
||
| Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
|
||
| |maintainer-ntsirintanis| | ||
|
|
||
| This module is part of the `OCA/calendar <https://github.com/OCA/calendar/tree/16.0/calendar_shared_ics>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| from . import controllers | ||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Copyright 2025 Therp BV <https://therp.nl> | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
| { | ||
| "name": "Shared ICS calendars (token-protected)", | ||
| "version": "16.0.1.0.0", | ||
| "category": "Calendar", | ||
| "summary": "Share readonly calendar feeds via ICS with access tokens", | ||
| "license": "AGPL-3", | ||
| "author": "Therp BV, Odoo Community Association (OCA)", | ||
| "website": "https://github.com/OCA/calendar", | ||
| "depends": ["calendar", "portal", "mail"], | ||
| "data": [ | ||
| "security/res_groups.xml", | ||
| "security/ir.model.access.csv", | ||
| "security/ir_rule.xml", | ||
| "views/calendar_shared_ics_views.xml", | ||
| "views/landing_page.xml", | ||
| ], | ||
| "installable": True, | ||
| "application": False, | ||
| "external_dependencies": {"python": ["vobject"]}, | ||
| "maintainers": ["ntsirintanis"], | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Copyright 2025 Therp BV <https://therp.nl> | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
| from odoo.http import Controller, content_disposition, request, route | ||
|
|
||
|
|
||
| class CalendarSharedIcsController(Controller): | ||
| @route( | ||
| ["/calendar/shared/<model('calendar.shared.ics'):shared>/ics"], | ||
| type="http", | ||
| auth="public", | ||
| csrf=False, | ||
| sitemap=False, | ||
| ) | ||
| def calendar_shared_ics(self, shared, **kwargs): | ||
| # super minimal, all the actual work | ||
| # takes place in calendar.shared.ics | ||
| shared = shared.sudo() | ||
| if not shared.exists() or not shared.active: | ||
| raise request.not_found() | ||
| if not shared._check_access_token(kwargs.get("access_token")): | ||
| raise request.not_found() | ||
| try: | ||
| content = shared._render_ics_content() | ||
| except Exception: | ||
| raise request.not_found() from None | ||
| filename = shared._get_ics_filename() | ||
| return request.make_response( | ||
| content, | ||
| [ | ||
| ("Content-Type", "text/calendar; charset=utf-8"), | ||
| ("Content-Disposition", content_disposition(filename)), | ||
| ("Cache-Control", "no-store"), | ||
| ], | ||
| ) | ||
|
|
||
| @route( | ||
| ["/calendar/shared/<model('calendar.shared.ics'):shared>/landing"], | ||
| type="http", | ||
| auth="public", | ||
| csrf=False, | ||
| sitemap=False, | ||
| ) | ||
| def calendar_shared_ics_landing(self, shared, **kwargs): | ||
| # Public landing page: user can copy/paste the https/webcal subscription URL. | ||
| # and also login in the backend, if internal | ||
| shared = shared.sudo() | ||
| if not shared.exists() or not shared.active: | ||
| raise request.not_found() | ||
| if not shared._check_access_token(kwargs.get("access_token")): | ||
| raise request.not_found() | ||
| shared._portal_ensure_token() | ||
| backend_url = "%s/web#id=%s&model=%s&view_type=form" % ( | ||
| shared.get_base_url(), | ||
| shared.id, | ||
| shared._name, | ||
| ) | ||
| return request.render( | ||
| "calendar_shared_ics.shared_ics_landing_page", | ||
| { | ||
| "shared": shared, | ||
| "ics_url": shared.share_url, | ||
| "webcal_url": shared.share_webcal_url, | ||
| "backend_url": backend_url, | ||
| }, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import calendar_shared_ics |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.