-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] cetmix_tower_server: Access rules
Add access rules for tower keys Task: 4300
- Loading branch information
1 parent
aa494bb
commit 3da1941
Showing
9 changed files
with
546 additions
and
521 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 @@ | ||
# Copyright (C) 2025 Cetmix OÜ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
server_ids = fields.One2many( | ||
string="Servers", | ||
comodel_name="cx.tower.server", | ||
inverse_name="partner_id", | ||
help="Cetmix Tower servers that belong to this partner", | ||
) |
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,30 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="cx_tower_key_rule_group_manager_access" model="ir.rule"> | ||
<field name="name">Tower Key: manager access rule</field> | ||
<field name="model_id" ref="model_cx_tower_key" /> | ||
<field name="domain_force"> | ||
[ | ||
"|", | ||
"&", | ||
("server_id", "=", False), | ||
("server_ssh_ids", "=", False), | ||
"|", | ||
"|", | ||
("server_id.message_partner_ids", "in", [user.partner_id.id]), | ||
("server_ssh_ids.message_partner_ids", "in", [user.partner_id.id]), | ||
("partner_id.server_ids.message_partner_ids", "in", [user.partner_id.id]), | ||
] | ||
</field> | ||
<field name="groups" eval="[(4, ref('cetmix_tower_server.group_manager'))]" /> | ||
</record> | ||
|
||
<record id="cx_tower_key_rule_group_root_access" model="ir.rule"> | ||
<field name="name">Tower Key: root access rule</field> | ||
<field name="model_id" ref="model_cx_tower_key" /> | ||
<field name="domain_force">[(1, "=", 1)]</field> | ||
<field name="groups" eval="[(4,ref('cetmix_tower_server.group_root'))]" /> | ||
</record> | ||
|
||
</odoo> |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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