-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] website_event_private: new module
- Loading branch information
1 parent
7b13259
commit e8520ea
Showing
23 changed files
with
955 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
../../../../website_event_private |
This file contains 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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains 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,101 @@ | ||
===================== | ||
Website Event Private | ||
===================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:e2fa0df647bdf86e9ad2ca5b9877819b436963e805bc2b4de1237d0e104d109d | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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%2Fevent-lightgray.png?logo=github | ||
:target: https://github.com/OCA/event/tree/16.0/website_event_private | ||
:alt: OCA/event | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/event-16-0/event-16-0-website_event_private | ||
: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/event&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows you to configure the privacy of website events : | ||
|
||
* *Public*: anyone can view the event and register | ||
* *Private displayed*: the event appears in the event list (but not clickable) and one needs access token to see content / register | ||
* *Private hidden*: the event does not appear in the list of events and one needs access token to see content / register | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
|
||
To configure this module, you need to: | ||
|
||
#. Go to an event and set the privacy option | ||
#. If you select private displayed or hidden, access token link will appear just after the privacy field | ||
|
||
Usage | ||
===== | ||
|
||
On private event record, you need to share the access link which is generated | ||
and accessible on backend event form to give access to the event. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/event/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/event/issues/new?body=module:%20website_event_private%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 | ||
~~~~~~~ | ||
|
||
* Le Filament | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Juliana <JulianaPoudou> | ||
* Benjamin <benj-filament> | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
* Le Filament <https://www.le-filament.com> | ||
|
||
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. | ||
|
||
This module is part of the `OCA/event <https://github.com/OCA/event/tree/16.0/website_event_private>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains 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 models | ||
from . import controllers |
This file contains 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 @@ | ||
{ | ||
"name": "Website Event Private", | ||
"summary": "Website Event Private", | ||
"version": "16.0.1.0.0", | ||
"author": "Le Filament, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"website": "https://github.com/OCA/event", | ||
"application": False, | ||
"category": "Marketing", | ||
"depends": ["website_event"], | ||
"data": [ | ||
"templates/event_templates_list.xml", | ||
"views/event_views.xml", | ||
"views/event_type_views.xml", | ||
], | ||
"assets": { | ||
"web.assets_frontend": [ | ||
"website_event_private/static/src/scss/website_event_private.scss", | ||
], | ||
}, | ||
"installable": True, | ||
"auto_install": False, | ||
} |
This file contains 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 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,62 @@ | ||
# Copyright 2023- Le Filament (https://le-filament.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import http | ||
from odoo.http import request | ||
|
||
from odoo.addons.website_event.controllers.main import WebsiteEventController | ||
|
||
|
||
class WebsiteEvent(WebsiteEventController): | ||
# ------------------------------------------------------ | ||
# Inherit parent routes | ||
# ------------------------------------------------------ | ||
@http.route() | ||
def event_page(self, event, page, **post): | ||
if not self._check_privacy(event, **post): | ||
return request.redirect("/event") | ||
|
||
return super(WebsiteEvent, self).event_page(event, page, **post) | ||
|
||
@http.route() | ||
def event(self, event, **post): | ||
if not self._check_privacy(event, **post): | ||
return request.redirect("/event") | ||
|
||
return super(WebsiteEvent, self).event(event, **post) | ||
|
||
@http.route() | ||
def event_register(self, event, **post): | ||
if not self._check_privacy(event, **post): | ||
return request.redirect("/event") | ||
|
||
return super(WebsiteEvent, self).event_register(event, **post) | ||
|
||
# ------------------------------------------------------ | ||
# Business method | ||
# ------------------------------------------------------ | ||
def _check_privacy(self, event, **post): | ||
if event.event_privacy != "public" and not request.env.user.has_group( | ||
"website.group_website_restricted_editor" | ||
): | ||
cookie = request.httprequest.cookies.get("odoo-event-%d" % event.id) | ||
if ( | ||
post | ||
and post.get("access_token") | ||
and post.get("access_token") == event.access_token | ||
): | ||
access_token = post.get("access_token") | ||
request.future_response.set_cookie( | ||
key="odoo-event-%d" % event.id, | ||
value=access_token, | ||
max_age=10 * 86400, | ||
secure=True, | ||
httponly=True, | ||
samesite="Strict", | ||
) | ||
return True | ||
elif cookie and cookie == event.access_token: | ||
return True | ||
else: | ||
return False | ||
return True | ||
This file contains 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 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_event_private | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-08-14 13:05+0000\n" | ||
"PO-Revision-Date: 2024-08-14 13:05+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: website_event_private | ||
#: model_terms:ir.ui.view,arch_db:website_event_private.events_private_list | ||
msgid "<i class=\"fa fa-user-secret me-2\"/>Private" | ||
msgstr "<i class=\"fa fa-user-secret me-2\"/>Privé" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model,name:website_event_private.model_event_event | ||
msgid "Event" | ||
msgstr "Évènement" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model,name:website_event_private.model_event_type | ||
msgid "Event Template" | ||
msgstr "Modèle d'événement" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields,field_description:website_event_private.field_event_event__event_share_link | ||
msgid "Event link" | ||
msgstr "Lien d'accès à l'évènement" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields,field_description:website_event_private.field_event_event__event_privacy | ||
#: model:ir.model.fields,field_description:website_event_private.field_event_type__event_privacy | ||
msgid "Event privacy" | ||
msgstr "Confidentialité de l'évènement" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_event__event_privacy__private_displayed | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_type__event_privacy__private_displayed | ||
msgid "Private displayed" | ||
msgstr "Privé mais listé" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_event__event_privacy__private_hidden | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_type__event_privacy__private_hidden | ||
msgid "Private hidden" | ||
msgstr "Privé et non listé" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_event__event_privacy__public | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_type__event_privacy__public | ||
msgid "Public" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields,field_description:website_event_private.field_event_event__access_token | ||
msgid "Security Token" | ||
msgstr "Jeton de sécurité" |
This file contains 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 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_event_private | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-08-14 13:05+0000\n" | ||
"PO-Revision-Date: 2024-08-14 13:05+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: website_event_private | ||
#: model_terms:ir.ui.view,arch_db:website_event_private.events_private_list | ||
msgid "<i class=\"fa fa-user-secret me-2\"/>Private" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model,name:website_event_private.model_event_event | ||
msgid "Event" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model,name:website_event_private.model_event_type | ||
msgid "Event Template" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields,field_description:website_event_private.field_event_event__event_share_link | ||
msgid "Event link" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields,field_description:website_event_private.field_event_event__event_privacy | ||
#: model:ir.model.fields,field_description:website_event_private.field_event_type__event_privacy | ||
msgid "Event privacy" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_event__event_privacy__private_displayed | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_type__event_privacy__private_displayed | ||
msgid "Private displayed" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_event__event_privacy__private_hidden | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_type__event_privacy__private_hidden | ||
msgid "Private hidden" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_event__event_privacy__public | ||
#: model:ir.model.fields.selection,name:website_event_private.selection__event_type__event_privacy__public | ||
msgid "Public" | ||
msgstr "" | ||
|
||
#. module: website_event_private | ||
#: model:ir.model.fields,field_description:website_event_private.field_event_event__access_token | ||
msgid "Security Token" | ||
msgstr "" |
This file contains 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 event_type | ||
from . import event_event |
Oops, something went wrong.