3
<?xml version="1.0" ?>
<openerp>
    <data>
        <record model="ir.module.category" id="module_lunch_category">
            <field name="name">Lunch</field>
            <field name="description">Helps you handle your lunch needs, if you are a manager you will be able to create new products, cashmoves and to confirm or cancel orders.</field>
            <field name="sequence">16</field>
        </record>
        <record id="group_lunch_user" model="res.groups">
            <field name="name">User</field>
            <field name="category_id" ref="module_lunch_category"/>
        </record>
        <record id="group_lunch_manager" model="res.groups">
            <field name="name">Manager</field>
            <field name="implied_ids" eval="[(4, ref('group_lunch_user'))]"/>
            <field name="category_id" ref="module_lunch_category"/>
            <field name="users" eval="[(4, ref('base.user_root'))]"/>
        </record>
    </data>
</openerp>

私は今、自分のアプリケーションへのセキュリティ処理で立ち往生しています.そのコードはここに表示されます

上記のxmlコードを明確にするために、ドキュメントも参照します。しかし、ドキュメンテーションでバージョン 7 の適切な説明が得られません。以下のセクションを明確にする必要があります。それについて明確な考えを得るために私にアドバイスしてください

説明してください

ir.module.category は?

<record model="ir.module.category" id="module_lunch_category">

model="res.groups" とは?

<record id="group_lunch_user" model="res.groups">

下の行全体を明確にする必要があります

<field name="implied_ids" eval="[(4, ref('group_lunch_user'))]"/>
4

2 に答える 2

11
1. <record model="ir.module.category" id="module_lunch_category">

これは、購入、倉庫、または独自のモジュールなどのアプリケーション名でカテゴリを作成するために使用されます。特定のグループがこのモジュールに属しているように、それはモジュールの名前にすぎません。モジュール名 bpl のように、ir.module.category にBPLを作成します。

2. <record id="group_lunch_user" model="res.groups">

これは、ユーザーを作成し、アプリケーションのこのユーザーにアクセス権を付与したい場合のように、このアプリケーションのグループを作成するために使用され、このグループをユーザーに追加します。

セキュリティ上の理由から、いくつかのメニュー、いくつかのフィールドにさまざまなユーザーがアクセスできるようにするため、グループを作成します。「USER」とMANAGERグループを作成するのと同じように。

<record model="res.groups" id="group_bpl_manager">
            <field name="name">Manager</field>
        </record>


<record model="res.groups" id="group_bpl_user">
            <field name="name">User</field>
        </record>

管理者グループで作成したこれらの 2 つのグループは、すべてのメニューとすべてのフィールドにアクセスできますが、ユーザー グループはアクセスが制限されているため、フル アクセスを許可するユーザーに管理者グループと制限付きアクセスを割り当ててから、そのユーザーにユーザー グループを割り当てます。 .

3.<field name="implied_ids" eval="[(4, ref('group_lunch_user'))]"/>

Users of this group automatically inherit these groups で定義されているように、このグループを任意のユーザーに割り当てると、このフィールドに指定されたすべてのグループにも自動的にアクセスすることを意味しますimplied_ids

あるユーザーに割り当てる場合の BPL Manager グループの例。このグループを割り当てるときに、他の多くのグループをそのユーザーに割り当てたい場合、「継承された」暗黙の IDフィールドで他の多くのグループをこのグループに追加します。

于 2013-04-12T05:07:43.213 に答える