模块开发: Difference between revisions

Line 536: Line 536:
</syntaxhighlight>
</syntaxhighlight>


Into $this->rights[$r][0], put a permission id not already used (See into menu '''System info''' on a working installation of Dolibarr to know list of id already used by standard modules.
在$this->rights[$r][0]中,输入尚未使用的权限ID(请参阅'''系统信息'''菜单,在运行Dolibarr的设备上查看已在使用的ID)。
Into $this->rights[$r][3], put 1 if this permission must be granted automatically by default to any new created user.
 
Into $this->rights[$r][1], put a label by default for permission (This label will be used if no translation can be found into the file '''admin.lang''').
在$this->rights[$r][1]中,输入默认标签(如果在 '''admin.lang''' 文件中找不到您权限标签的翻译字符串,则显示该标签。翻译键值为 “Permission10001=我的超级权限的描述”)。
Into $this->rights[$r][4] and $this->rights[$r][5], put an action and subaction string without spaces. You will be able to test if a user has the permission in your PHP source code with the sequence:
 
在$this>rights[$r][2]中,输入权限类型。有三种类型的权限,“r”表示读取、列出清单或导出权限,“w”表示写入或更新权限,“d”表示删除权限。
 
在$this->rights[$r][3]中,如果任何一个新创建的用户都会被默认自动分配此权限,则输入1。
 
在$this->rights[$r][4]和$this->rights[$r][5]中,输入不带空格的操作和子操作字符串。然后,您可以通过以下命令在PHP代码中测试用户是否具有正确的权限:


<syntaxhighlight lang="PHP">
<syntaxhighlight lang="PHP">
715

edits