diff options
| author | Hiral Bhavsar <hbh@odoo.com> | 2020-01-02 07:22:46 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-03-20 10:09:10 +0000 |
| commit | 73834a659c72639b1c3e2a18bfd431b35089ef1e (patch) | |
| tree | 812e0840fdeb1b01665ce4458d369e0f2137a1cc /addons/web | |
| parent | 3e9293e0e8bfa6561288b03980e7fe34206a3087 (diff) | |
[IMP] calendar, web: private events shouldn't be editable/deletable
Before this commit, when user attempts to edit or delete a private
event without being an attendee, it raises an access right error.
This commit disables edit and delete buttons in this case, in
addition to hide event details.
task-2151150
Closes https://github.com/odoo/odoo/pull/42569
closes odoo/odoo#42569
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/web')
| -rw-r--r-- | addons/web/static/src/js/views/calendar/calendar_popover.js | 25 | ||||
| -rw-r--r-- | addons/web/static/src/xml/web_calendar.xml | 6 |
2 files changed, 27 insertions, 4 deletions
diff --git a/addons/web/static/src/js/views/calendar/calendar_popover.js b/addons/web/static/src/js/views/calendar/calendar_popover.js index 1094f345c7d..8a5e5a7ecae 100644 --- a/addons/web/static/src/js/views/calendar/calendar_popover.js +++ b/addons/web/static/src/js/views/calendar/calendar_popover.js @@ -27,7 +27,7 @@ var CalendarPopover = Widget.extend(StandaloneFieldManagerMixin, { this.fields = eventInfo.fields; this.event = eventInfo.event; this.modelName = eventInfo.modelName; - this.canDelete = eventInfo.canDelete; + this._canDelete = eventInfo.canDelete; }, /** * @override @@ -47,6 +47,29 @@ var CalendarPopover = Widget.extend(StandaloneFieldManagerMixin, { }, //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * @return {boolean} + */ + isEventDeletable() { + return this._canDelete;; + }, + /** + * @return {boolean} + */ + isEventDetailsVisible() { + return true; + }, + /** + * @return {boolean} + */ + isEventEditable() { + return true; + }, + + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- diff --git a/addons/web/static/src/xml/web_calendar.xml b/addons/web/static/src/xml/web_calendar.xml index 1ab1d935896..be0d645e45f 100644 --- a/addons/web/static/src/xml/web_calendar.xml +++ b/addons/web/static/src/xml/web_calendar.xml @@ -42,10 +42,10 @@ <b t-esc="widget.eventTime.time"/> <small t-if="widget.eventTime.duration"><b t-esc="_.str.sprintf('(%s)', widget.eventTime.duration)"/></small> </li> </ul> - <ul class="list-group list-group-flush o_cw_popover_fields_secondary"/> + <ul t-if="widget.isEventDetailsVisible()" class="list-group list-group-flush o_cw_popover_fields_secondary"/> <div class="card-footer border-top"> - <a href="#" class="btn btn-primary o_cw_popover_edit">Edit</a> - <a t-if="widget.canDelete" href="#" class="btn btn-secondary o_cw_popover_delete ml-2">Delete</a> + <a t-if="widget.isEventEditable()" href="#" class="btn btn-primary o_cw_popover_edit">Edit</a> + <a t-if="widget.isEventDeletable()" href="#" class="btn btn-secondary o_cw_popover_delete ml-2">Delete</a> </div> </div> </t> |
