Skip to content

Commit 49ab4f6

Browse files
committed
Add ACL for public users to see published events' images.
1 parent 13e67ea commit 49ab4f6

File tree

7 files changed

+58
-12
lines changed

7 files changed

+58
-12
lines changed

website_event_multi_image/README.rst

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
33
:alt: License: AGPL-3
44

5-
=================================
5+
==================================
66
Multi images for events in website
7-
=================================
7+
==================================
88

99
This module extends the functionality of website events to support having a
1010
thumbnail in events list and an image gallery per event displayed as a carousel
@@ -16,7 +16,7 @@ Installation
1616

1717
To install this module, you need to:
1818

19-
* Install `OCA/product-attribute <https://github.com/OCA/product-attribute/>`_.
19+
* Install `OCA/server-tools <https://github.com/OCA/server-tools/>`_.
2020

2121
Configuration
2222
=============
@@ -51,11 +51,6 @@ To use this module, you need to:
5151
:alt: Try me on Runbot
5252
:target: https://runbot.odoo-community.org/runbot/199/8.0
5353

54-
Known issues / Roadmap
55-
======================
56-
57-
* ...
58-
5954
Bug Tracker
6055
===========
6156

@@ -74,8 +69,8 @@ Credits
7469
Contributors
7570
------------
7671

77-
* Rafael Blasco <rafabn@antiun.com>
78-
* Jairo Llopis <yajo.sk8@gmail.com>
72+
* Rafael Blasco <rafael.blasco@tecnativa.com>
73+
* Jairo Llopis <jairo.llopis@tecnativa.com>
7974

8075
Maintainer
8176
----------
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2016 Jairo Llopis <[email protected]>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
from . import models

website_event_multi_image/__openerp__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
"summary": "Show a gallery of images per event in their website",
77
"version": "8.0.1.0.0",
88
"category": "Event Management",
9-
"website": "http://www.antiun.com",
10-
"author": "Antiun Ingeniería S.L., Odoo Community Association (OCA)",
9+
"website": "http://www.tecnativa.com",
10+
"author": "Antiun Ingeniería S.L., "
11+
"Tecnativa, "
12+
"Odoo Community Association (OCA)",
1113
"license": "AGPL-3",
1214
"application": False,
1315
"installable": True,
@@ -17,6 +19,8 @@
1719
"website_multi_image",
1820
],
1921
"data": [
22+
"security/ir_rule.yml",
23+
"security/ir.model.access.csv",
2024
"views/event_templates.xml",
2125
],
2226
"images": [
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2016 Jairo Llopis <[email protected]>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
from . import image
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2016 Jairo Llopis <[email protected]>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
from openerp import api, fields, models
6+
7+
8+
class MultiImage(models.Model):
9+
_inherit = "base_multi_image.image"
10+
11+
event_published = fields.Boolean(
12+
compute="_compute_event_published",
13+
store=True,
14+
)
15+
16+
@api.multi
17+
@api.depends("owner_model", "owner_id")
18+
def _compute_event_published(self):
19+
"""Know if this image is from a published event."""
20+
for s in self:
21+
if s.owner_model == "event.event":
22+
s.event_published = (self.env[s.owner_model].sudo()
23+
.browse(s.owner_id).published)
24+
else:
25+
s.event_published = False
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2+
public_image_access,Allow public to read published event images,base_multi_image.model_base_multi_image_image,base.group_public,1,0,0,0
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2016 Jairo Llopis <[email protected]>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
- !record {model: ir.rule, id: public_image_rule}:
6+
name: Public only sees images of published events
7+
model_id: base_multi_image.model_base_multi_image_image
8+
domain_force: [("event_published", "=", True)]
9+
groups:
10+
- base.group_public

0 commit comments

Comments
 (0)