Thanks to the sharing of the netizen "抬头看脚趾", this article is reproduced from: http://blog.sina.com.cn/s/blog_40b223160101geq6.html.
This article will describe how to set the permissions for the new module.
In ZenTao Opensource series, the permissions of all control methods are assigned and controlled through group/lang/resource.php (PS: By default, all control methods are accessible only by administrators). The access permissions could be set in "Company-Privilege", as shown in the picture below.
In order to be able to add new modules or control methods based on existing modules to be displayed in the interface and assigned permissions, it is necessary to extend module/group/lang/resource.php, as the following is an example of the index control method for the menudemo module。
- Create files "menudemo.php" in folders "module/group/ext/lang/zh-cn/", "module/group/ext/lang/zh-tw/", and "module/group/ext/lang/en/".
- Add the following code to the file "menudemo.php" (group/ext/lang/zh-cn/menudemo.php group/ext/lang/zh-tw/menudemo.php group/ext/lang/en/menudemo.php)
<?php $lang->resource->menudemo = new stdclass(); $lang->resource->menudemo->index = 'index';
-
Display the name declaration in the screen
The display name must be declared first in order to be able to visually displayed in the permission assignment screen. The declaration is usually being set in the file lang.
module/menudemo/lang/zh-cn.php
$lang->menudemo->common = 'navigationDemo'; $lang->menudemo->index = 'homepage'; $lang->menudemo->methodOrder[5] = 'index';
-
$lang->menudemo->methodOrder[5] = 'index'; is defined to control the order of display.
It's also naseberry to add the content above to zh-tw.php en.php, otherwise the assignment screen will not display information when the interface language is switched.