当前位置:网站首页>Odoo 的安全性
Odoo 的安全性
2022-07-13 19:18:00 【姜振建 15954039008】
除了使用自定义代码手动管理访问之外,Odoo 还提供了三种主要的数据驱动机制来管理或限制对数据的访问。
1、groups组:
这两种机制都通过组链接到特定的用户:一个用户属于任意数量的组,安全机制与组相关联,从而将安全机制应用于用户。
class res.groups
name
组名
category_id
模块类别,用于将组与 Odoo 应用程序(~一组相关的业务模型)相关联,并将它们转换为用户表单中的专有选择。
implied_ids
继承权限,其中的implied是包含的意思
comment
关于组的附加说明
2、记录规则
记录规则是为了允许操作而必须满足的条件。记录规则按照访问权限逐个记录进行评估。
记录规则是默认允许的:如果访问权限授予访问权限并且没有规则适用于用户的操作和模型,则授予访问权限。
class ir.rule
name
名称
model_id
规则适用的模型。
groups
res.groups授予(或不授予)访问权限的。可以指定多个组。如果未指定组,则规则是全局的,其处理方式与“组”规则不同。
global
基于 计算groups,可轻松访问规则的全局状态(或非全局状态)。
domain_force
指定权限组
域是一个python 表达式,可以使用以下变量:
time
Python 的time模块。
user
当前用户,作为单例记录集。
company_id
当前用户当前选择的公司作为单个公司 ID。
company_ids
当前用户有权访问的所有公司作为公司 ID 列表
3、字段设置权限
在 scurty文件中新增一个xml(res.groups.xml)文件在文件中下写入语句
<odoo>
<record id="sale_order_group_price" model="res.groups">
<field name="name">销售价格显示</field>
</record>
</odoo>
新增的xml文件需要在__manifest__.py 中引用
'data': [
'security/res.groups.xml', #第一步创建的文件
'views/field_permissions_views.xml', #需要使用权限组的文件
],
在views文件中新增一个xml(field_permissions_views.xm)文件对应的字段后面写groups就好了
<field name="price_unit" groups="fields_jurisdiction.sale_order_group_price"/>
fields_jurisdiction;是你的模块名称;sale_order_group_price:刚才你在第一步中增加的xml 对应< record 的id
使用: 设置中找到用户, 找到对应的名称(本文:销售价格显示)勾选上此用户就有了你设置的权限。
边栏推荐
- Audio and video learning (VI) -- PCM audio Basics
- Hardware iic+dma operation sharing based on stm32f405
- HCIP静态路由
- Web安全-ReDos正则表达式的拒绝服务攻击
- ADB环境配置
- Programmer transformation project management? Get a PMP?
- Lesson 3: shortest distance
- C language register skills (struct and union)
- [go] Ⅱ. Introduction à l'API reposante et au processus et à la structure du Code de l'API
- Web security - DOS regular expression denial of service attack
猜你喜欢

babylon. JS height map

C language development environment construction: vscode+gcc

模拟实现库函数strcpy,对strcpy的进一步理解(深刻理解重叠问题,防止内存与源重叠)

3dmax2021 中的各种显示相关如何设置?

Interprocess communication (very practical)

有没有完全自主的国产化数据库技术

Where is the win11 uninstaller? Two methods of uninstalling software in win11

容错、熔断的使用与扩展

YOLOv5使用时遇到的问题

Preorder and inorder traversal sequences determine a binary tree (restore binary tree)
随机推荐
babylon. JS height map
How to apply for PMP project management certification examination?
How to recover the files deleted by win11 security center?
This article takes you to understand what tensors are in deep learning, how their operations are, how to understand tensors, and the dimensions of tensors, which are easy to understand
Hcip day 4 notes
我打开 datastutio的权限,自动生成了一个sql任务,一直在执行,这是说明权限分配还没执行完
Jerry's VM will cause the nixie tube to flash when sorting [chapter]
Where is the win11 uninstaller? Two methods of uninstalling software in win11
Hj8 consolidated statement record hj08
HCIP第二个实验
音视频学习(六)——PCM音频基础
No one really thinks that chatting robots are difficult -- using Bert to load the pre training model to get Chinese sentence vectors
babylon.js高度图
Running process of program
How to manage win11 local users and groups? Win11 method of creating user administrator
Jerry's IR may lose code [article]
匿名管道原理及详解(非常实用)
How does win11 share folders? Win11 method of creating shared folder
Development of management
有没有完全自主的国产化数据库技术