714
edits
Thecyyoung (talk | contribs) m (1. 修正 listGroupForUser() 要傳入的是 id 而非物件 2. $listofgroup可能是從[1]開始) Tag: 2017 source edit |
No edit summary |
||
| Line 13: | Line 13: | ||
{{TemplateMainPageZh}} | {{TemplateMainPageZh}} | ||
每个权限都分配了一个唯一的ID。Dolibarr中管理的所有权限都存储在 [[Table llx_rights_def|表llx_rights_def]] 中,并具有一个ID。该ID还用于链接用户和权限(链接存储在 [[Table llx_user_rights|表llx_user_rights]] 中)或链接组和权限(链接存储在 [[Table llx_usergroup_rights|表llx_usergroup_rights]] 中)。 | |||
=获取用户的权限和组= | |||
在Dolibarr代码页中,全局对象$user被自动设置。它包含有关当前用户的信息。这些权限可以通过判断访问 | |||
<source lang="php"> | <source lang="php"> | ||
| Line 32: | Line 22: | ||
</source> | </source> | ||
要了解给定用户所属的用户组,可以使用以下代码(Dolibarr 2.5或更高版本): | |||
<source lang="php"> | <source lang="php"> | ||
| Line 40: | Line 30: | ||
</source> | </source> | ||
$listofgroups是用户$ | $listofgroups是用户$fuser所属的所有UserGroups(组)对象的数组 | ||
$ | $fuser是加载的User对象 | ||
<source lang="php"> | <source lang="php"> | ||
| Line 49: | Line 39: | ||
</source> | </source> | ||
= 可用权限数组 = | =权限标识表-可用权限数组= | ||
每个功能模块都有自己的代码字符串,用于查看数组 $user->rights 并获取用户对模块的权限。这些代码的清单在模块的开发文档中给出。 | |||
单击此处查看 [[:Category:List of Modules (developer)|模块列表(开发)]] (并选择模块文档的开发版本以查看模块权限列表)。 | |||
edits