-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TA#66806 [16.0][MIG] ir_attachment_access_token_portal (#149)
Co-authored-by: Majda EL MARIOULI <[email protected]>
- Loading branch information
1 parent
2e87dcc
commit fcda1d4
Showing
6 changed files
with
61 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,16 @@ | ||
================================= | ||
Ir Attachment Access Token Portal | ||
================================= | ||
This module grant access to documents to the portal user. | ||
Due to security restriction, the portal user would see a error 500 if it tries to | ||
read a task that have a document. | ||
The error comes from the write required by the update of the access token. | ||
|
||
This module sudo the write to allow the portal user to have access to the documents. | ||
|
||
See TA#6109 | ||
|
||
|
||
Contributors | ||
------------ | ||
* Numigi (tm) and all its contributors (https://bit.ly/numigiens) |
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,4 @@ | ||
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import models |
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,13 @@ | ||
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
"name": "IR Attachment Token Access Portal", | ||
"version": "16.0.1.0.0", | ||
"author": "Numigi", | ||
"maintainer": "Numigi", | ||
"license": "LGPL-3", | ||
"category": "base", | ||
"summary": "This module grant access to documents to the portal user.", | ||
"installable": 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,4 @@ | ||
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import ir_attachment |
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,24 @@ | ||
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import models, fields | ||
|
||
|
||
class IrAttachmentTokenAccessPortal(models.Model): | ||
""" | ||
Allow portal user to access the ir.attachments of tasks. | ||
see ref: TA#6109 | ||
""" | ||
|
||
_inherit = "ir.attachment" | ||
|
||
access_token = fields.Char(groups="base.group_user,base.group_portal") | ||
|
||
def generate_access_token(self): | ||
""" | ||
Grant sudo access to the field ir_attachment.access_token | ||
It prevents to give write rights to ir.attachments and project.task to group_portal. | ||
see ref: TA#6109 | ||
""" | ||
return super(IrAttachmentTokenAccessPortal, self.sudo()).generate_access_token() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.