diff --git a/calendar_event_security/README.rst b/calendar_event_security/README.rst new file mode 100644 index 0000000..fad2e77 --- /dev/null +++ b/calendar_event_security/README.rst @@ -0,0 +1,66 @@ +======================= +Calendar Event Security +======================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5cefe42e701ccc14a206fa0a5414a8867164b406dbf79798457f2ea08a622068 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-solvosci%2Fslv--calendar-lightgray.png?logo=github + :target: https://github.com/solvosci/slv-calendar/tree/17.0/calendar_event_security + :alt: solvosci/slv-calendar + +|badge1| |badge2| |badge3| + +By default, all users can modify/delete a calendar event if they are +followers or attendees of the event or not. To restrict that, now only +the followers or attendees of an calendar event will be able to +modify/delete it. Also, there is a new group in "Extra Rights" that +allows a user, follower/attendee or not, to modify/delete an calendar +event. By default, user admin will be able to modify and delete calendar +events. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Solvos + +Contributors +------------ + +- Iria Alonso + +Maintainers +----------- + +This module is part of the `solvosci/slv-calendar `_ project on GitHub. + +You are welcome to contribute. diff --git a/calendar_event_security/__init__.py b/calendar_event_security/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/calendar_event_security/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/calendar_event_security/__manifest__.py b/calendar_event_security/__manifest__.py new file mode 100644 index 0000000..4f8a626 --- /dev/null +++ b/calendar_event_security/__manifest__.py @@ -0,0 +1,23 @@ +# © 2025 Solvos Consultoría Informática () +# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html +{ + "name": "Calendar Event Security", + "summary": """ + By default, all users can modify/delete a calendar event if they are followers or attendees of the event or not. + To restrict that, now only the followers or attendees of an calendar event will be able to modify/delete it. + Also, there is a new group in "Extra Rights" that allows a user, follower/attendee or not, to modify/delete an calendar event. + By default, user admin will be able to modify and delete calendar events. + """, + "author": "Solvos", + "license": "LGPL-3", + "version": "17.0.1.0.0", + "category": "Account", + "website": "https://github.com/solvosci/slv-calendar", + "depends": [ + "calendar", + ], + "data": [ + "security/calendar_event.xml", + ], + "installable": True, +} diff --git a/calendar_event_security/i18n/calendar_event_security.pot b/calendar_event_security/i18n/calendar_event_security.pot new file mode 100644 index 0000000..00fc9e7 --- /dev/null +++ b/calendar_event_security/i18n/calendar_event_security.pot @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * calendar_event_security +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-04-21 08:08+0000\n" +"PO-Revision-Date: 2025-04-21 08:08+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: calendar_event_security +#: model:res.groups,name:calendar_event_security.group_calendar_event_manager +msgid "Calendar: edit all events" +msgstr "" diff --git a/calendar_event_security/i18n/es.po b/calendar_event_security/i18n/es.po new file mode 100644 index 0000000..6392654 --- /dev/null +++ b/calendar_event_security/i18n/es.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * calendar_event_security +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-04-21 08:08+0000\n" +"PO-Revision-Date: 2025-04-21 08:08+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: calendar_event_security +#: model:res.groups,name:calendar_event_security.group_calendar_event_manager +msgid "Calendar: edit all events" +msgstr "Calendario: editar todos los eventos" diff --git a/calendar_event_security/models/__init__.py b/calendar_event_security/models/__init__.py new file mode 100644 index 0000000..ba757cb --- /dev/null +++ b/calendar_event_security/models/__init__.py @@ -0,0 +1 @@ +from . import calendar_event diff --git a/calendar_event_security/models/calendar_event.py b/calendar_event_security/models/calendar_event.py new file mode 100644 index 0000000..671a519 --- /dev/null +++ b/calendar_event_security/models/calendar_event.py @@ -0,0 +1,21 @@ +# © 2025 Solvos Consultoría Informática () +# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html + +from odoo import models, fields, api + + +class CalendarEvent(models.Model): + _inherit = 'calendar.event' + + message_follower_ids = fields.One2many(auto_join=True) + + @api.depends('partner_ids', 'message_follower_ids') + @api.depends_context('uid') + def _compute_user_can_edit(self): + super()._compute_user_can_edit() + for event in self: + if event.user_can_edit: + continue + + if self.env.user.partner_id in event.message_follower_ids.partner_id or self.env.user.has_group("calendar_event_security.group_calendar_event_manager"): + event.user_can_edit = True diff --git a/calendar_event_security/readme/CONTRIBUTORS.md b/calendar_event_security/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..1f43251 --- /dev/null +++ b/calendar_event_security/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +* Iria Alonso \ diff --git a/calendar_event_security/readme/DESCRIPTION.md b/calendar_event_security/readme/DESCRIPTION.md new file mode 100644 index 0000000..611a0ba --- /dev/null +++ b/calendar_event_security/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +By default, all users can modify/delete a calendar event if they are followers or attendees of the event or not. +To restrict that, now only the followers or attendees of an calendar event will be able to modify/delete it. +Also, there is a new group in "Extra Rights" that allows a user, follower/attendee or not, to modify/delete an calendar event. +By default, user admin will be able to modify and delete calendar events. diff --git a/calendar_event_security/security/calendar_event.xml b/calendar_event_security/security/calendar_event.xml new file mode 100644 index 0000000..31233cd --- /dev/null +++ b/calendar_event_security/security/calendar_event.xml @@ -0,0 +1,32 @@ + + + + Calendar: edit all events + + + + + + + + Only Followers Can Write/Delete Calendar Events + ['|',('message_follower_ids.partner_id', '=', user.partner_id.id),('partner_ids','=',user.partner_id.id)] + + + + + + + + + + Calendar: Edit All Events + [(1,'=',1)] + + + + + + + + diff --git a/calendar_event_security/static/description/icon.png b/calendar_event_security/static/description/icon.png new file mode 100644 index 0000000..daa2a02 Binary files /dev/null and b/calendar_event_security/static/description/icon.png differ diff --git a/calendar_event_security/static/description/index.html b/calendar_event_security/static/description/index.html new file mode 100644 index 0000000..3ceffc1 --- /dev/null +++ b/calendar_event_security/static/description/index.html @@ -0,0 +1,421 @@ + + + + + +Calendar Event Security + + + +
+

Calendar Event Security

+ + +

Beta License: LGPL-3 solvosci/slv-calendar

+

By default, all users can modify/delete a calendar event if they are +followers or attendees of the event or not. To restrict that, now only +the followers or attendees of an calendar event will be able to +modify/delete it. Also, there is a new group in “Extra Rights” that +allows a user, follower/attendee or not, to modify/delete an calendar +event. By default, user admin will be able to modify and delete calendar +events.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Solvos
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the solvosci/slv-calendar project on GitHub.

+

You are welcome to contribute.

+
+
+
+ +