<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <!-- User Read Rule -->
    <record id="rule_cx_tower_variable_user_read" model="ir.rule">
        <field name="name">Variable: User Read Access</field>
        <field name="model_id" ref="model_cx_tower_variable" />
        <field name="domain_force">[('access_level', '=', '1')]</field>
        <field name="groups" eval="[(4, ref('cetmix_tower_server.group_user'))]" />
        <field name="perm_read" eval="1" />
        <field name="perm_write" eval="0" />
        <field name="perm_create" eval="0" />
        <field name="perm_unlink" eval="0" />
    </record>

    <!-- Manager Read Rule -->
    <record id="rule_cx_tower_variable_manager_read" model="ir.rule">
        <field name="name">Variable: Manager Read Access</field>
        <field name="model_id" ref="model_cx_tower_variable" />
        <field name="domain_force">[('access_level', '&lt;=', '2')]</field>
        <field name="groups" eval="[(4, ref('cetmix_tower_server.group_manager'))]" />
        <field name="perm_read" eval="1" />
        <field name="perm_write" eval="0" />
        <field name="perm_create" eval="0" />
        <field name="perm_unlink" eval="0" />
    </record>

    <!-- Manager Write/Create Rule -->
    <record id="rule_cx_tower_variable_manager_write" model="ir.rule">
        <field name="name">Variable: Manager Write/Create/Unlink Access</field>
        <field name="model_id" ref="model_cx_tower_variable" />
        <field
            name="domain_force"
        >[('access_level', '&lt;=', '2'), ('create_uid', '=', user.id)]</field>
        <field name="groups" eval="[(4, ref('cetmix_tower_server.group_manager'))]" />
        <field name="perm_read" eval="0" />
        <field name="perm_write" eval="1" />
        <field name="perm_create" eval="1" />
        <field name="perm_unlink" eval="1" />
    </record>

    <!-- Root Access Rule -->
    <record id="rule_cx_tower_variable_root" model="ir.rule">
        <field name="name">Variable: Root Full Access</field>
        <field name="model_id" ref="model_cx_tower_variable" />
        <field name="domain_force">[(1, '=', 1)]</field>
        <field name="groups" eval="[(4, ref('cetmix_tower_server.group_root'))]" />
        <field name="perm_read" eval="1" />
        <field name="perm_write" eval="1" />
        <field name="perm_create" eval="1" />
        <field name="perm_unlink" eval="1" />
    </record>
</odoo>
