Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions calendar_event_security/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/solvosci/slv-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/solvosci/slv-calendar/issues/new?body=module:%20calendar_event_security%0Aversion:%2017.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
-------

* Solvos

Contributors
------------

- Iria Alonso <iria.alonso@solvos.es>

Maintainers
-----------

This module is part of the `solvosci/slv-calendar <https://github.com/solvosci/slv-calendar/tree/17.0/calendar_event_security>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions calendar_event_security/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions calendar_event_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# © 2025 Solvos Consultoría Informática (<http://www.solvos.es>)
# 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,
}
21 changes: 21 additions & 0 deletions calendar_event_security/i18n/calendar_event_security.pot
Original file line number Diff line number Diff line change
@@ -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 ""
21 changes: 21 additions & 0 deletions calendar_event_security/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions calendar_event_security/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import calendar_event
21 changes: 21 additions & 0 deletions calendar_event_security/models/calendar_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# © 2025 Solvos Consultoría Informática (<http://www.solvos.es>)
# 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
1 change: 1 addition & 0 deletions calendar_event_security/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Iria Alonso \<iria.alonso@solvos.es\>
4 changes: 4 additions & 0 deletions calendar_event_security/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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.
32 changes: 32 additions & 0 deletions calendar_event_security/security/calendar_event.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<odoo>
<data noupdate="0">
<record id="group_calendar_event_manager" model="res.groups">
<field name="name">Calendar: edit all events</field>
<field name="category_id" ref="base.module_category_usability"/>
<field name="users" eval="[(4, ref('base.user_admin'))]"/>
</record>
</data>
<data noupdate="1">
<record id="calendar.calendar_event_rule_employee" model="ir.rule">
<field ref="calendar.model_calendar_event" name="model_id"/>
<field name="name">Only Followers Can Write/Delete Calendar Events</field>
<field name="domain_force">['|',('message_follower_ids.partner_id', '=', user.partner_id.id),('partner_ids','=',user.partner_id.id)]</field>
<field name="perm_read" eval="False"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="True"/>
<field eval="[(4,ref('base.group_user'))]" name="groups"/>
</record>

<record id="calendar_event_rule_all" model="ir.rule">
<field ref="calendar.model_calendar_event" name="model_id"/>
<field name="name">Calendar: Edit All Events</field>
<field name="domain_force">[(1,'=',1)]</field>
<field name="perm_read" eval="False"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="True"/>
<field name="groups" eval="[(4,ref('group_calendar_event_manager'))]" />
</record>
</data>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading