CRITICAL — Before starting, you MUST first use the Read tool to read ../ziniao-shared/SKILL.md
The access policy API is used to manage ERP web access permissions, including access rules, web page configuration, web page groups, and the binding relationships between accounts and access policies.
There is currently no access-policy shortcut command; all use the generic api command for direct calls. All APIs are POST、application/json, and the request body requires explicitly passing companyId。
Key Enumerations
| Field | Value | Description |
|---|---|---|
activeUser |
1 |
All members except boss |
activeUser |
2 |
Specified members |
activeUser |
3 |
Specified departments |
activeUser |
4 |
Specified roles |
activeAccount |
0 |
All accounts |
activeAccount |
1 |
Specified accounts |
activeRange |
1 |
All websites |
activeRange |
2 |
Specified URLs - blacklist |
activeRange |
3 |
Specified URLs - whitelist |
isActive |
0 |
Disabled |
isActive |
1 |
Enabled |
Access Rules
| Operation | API |
|---|---|
| Rule list | /superbrowser/rest/v1/erp/security/access_rule/list |
| Rule details | /superbrowser/rest/v1/erp/security/access_rule/detail |
| Create rule | /superbrowser/rest/v1/erp/security/access_rule/add |
| Edit rule | /superbrowser/rest/v1/erp/security/access_rule/edit |
| Delete rule | /superbrowser/rest/v1/erp/security/access_rule/delete |
| Enable/disable rule | /superbrowser/rest/v1/erp/security/access_rule/active |
| Set effective members | /superbrowser/rest/v1/erp/security/access_rule/change_user |
| Set effective accounts | /superbrowser/rest/v1/erp/security/access_rule/change_account |
| List of accounts that can be bound to the rule | /superbrowser/rest/v1/erp/security/access_rule/account/bindable_list |
# 查询访问规则
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/list \
--data '{"companyId":123,"page":1,"limit":20}'
# 查看规则详情
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/detail \
--data '{"companyId":123,"ruleId":456}'
# 删除规则,ruleIds 是数组
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/delete \
--data '{"companyId":123,"ruleIds":[456]}'
# 启用规则,禁用时 isActive 传 "0"
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/active \
--data '{"companyId":123,"ruleIds":[456],"isActive":"1"}'
The set effective members API has no shortcut command and must be called directly via api . The request body fields must be sent according to the API documentation:
| Field | Type | Description |
|---|---|---|
ruleId |
number | Rule ID |
activeUser |
number | 1 All members except boss;2 specified members;3 specified departments;4 specified roles |
userChange.addIds |
string[] | List of member IDs to add; pass [] |
userChange.addNames |
string[] | List of member usernames to add; pass [] |
userChange.deleteIds |
string[] | List of member IDs to remove; pass [] |
userChange.deleteNames |
string[] | List of member usernames to remove; pass [] |
departmentIds |
number[] | List of specified departments; pass [] |
roleIds |
number[] | List of specified roles; pass [] |
addIds and addNames either one can be passed; if both are passed, the union is taken;deleteIds/deleteNames cannot duplicate the add list.companyId is automatically injected by the CLI; do not manually pass common parameters in --data .
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/change_user \
--data '{"companyId":123,"ruleId":456,"activeUser":2,"userChange":{"addIds":["1001"],"deleteIds":[],"addNames":[],"deleteNames":[]},"departmentIds":[],"roleIds":[]}'
When setting effective accounts,accountChange.addIds and accountChange.deleteIds pass a string array of account IDs.
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/change_account \
--data '{"companyId":123,"ruleId":456,"activeAccount":1,"accountChange":{"addIds":["2001"],"deleteIds":[]}}'
The request body for creating/editing rules is relatively complex; the core structure is as follows:
{
"companyId": 123,
"name": "限制文件下载",
"desc": "运营角色适用",
"activeUser": 2,
"userChange": { "addIds": ["1001"], "addNames": [] },
"departmentIds": [],
"roleIds": [],
"activeAccount": 0,
"accountChange": { "addIds": [] },
"activeRange": "3",
"configs": [
{
"urlId": 789,
"isAccessible": true,
"isLog": true,
"functions": [
{ "function": "file_download", "permission": 3 }
]
}
],
"isSkipRuleConflictCheck": false,
"effectiveTime": { "timeType": "0", "startTime": 0, "endTime": 0 }
}
Web Pages and Web Page Groups
| Operation | API |
|---|---|
| Web page list | /superbrowser/rest/v1/erp/security/access_rule_url/list |
| Web page details | /superbrowser/rest/v1/erp/security/access_rule_url/detail |
| Add web page | /superbrowser/rest/v1/erp/security/access_rule_url/add |
| Edit web page | /superbrowser/rest/v1/erp/security/access_rule_url/edit |
| Delete web page | /superbrowser/rest/v1/erp/security/access_rule_url/delete |
| Change web page group | /superbrowser/rest/v1/erp/security/access_rule_url/change_group |
| Web page group list | /superbrowser/rest/v1/erp/security/access_rule_url_group/list |
| Add web page group | /superbrowser/rest/v1/erp/security/access_rule_url_group/add |
| Edit web page group | /superbrowser/rest/v1/erp/security/access_rule_url_group/edit |
| Delete web page group | /superbrowser/rest/v1/erp/security/access_rule_url_group/delete |
# 查询网页列表
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule_url/list \
--data '{"companyId":123,"page":1,"limit":20}'
# 添加网页
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule_url/add \
--data '{"companyId":123,"name":"Amazon后台","groupId":10,"urlPattern":"https://sellercentral.amazon.com/*","desc":"亚马逊后台"}'
# 移动网页到分组,urlIds 是数组
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule_url/change_group \
--data '{"companyId":123,"groupId":10,"urlIds":[789]}'
# 查询分组树,isAll=true 时返回 children
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule_url_group/list \
--data '{"companyId":123,"groupIdParent":0,"isAll":true}'
Account Binding Policies
| Operation | API |
|---|---|
| List of access policies bound to accounts | /superbrowser/rest/v1/erp/security/access_rule/list/one_account |
| Account added access policy | /superbrowser/rest/v1/erp/security/access_rule/account_ref/add_to_account |
| Account removed access policy | /superbrowser/rest/v1/erp/security/access_rule/account_ref/remove_from_account |
# 查询某账号已绑定的策略
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/list/one_account \
--data '{"companyId":123,"accountId":"2001","page":1,"limit":20}'
# 给账号添加访问策略
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/account_ref/add_to_account \
--data '{"companyId":123,"accountId":"2001","ruleIds":[456],"isSkipRuleConflictCheck":false}'
# 从账号移除访问策略
ziniao-cli api /superbrowser/rest/v1/erp/security/access_rule/account_ref/remove_from_account \
--data '{"companyId":123,"accountId":"2001","ruleIds":[456]}'
Notes
ruleIds、urlIds、platformIds、tagIds、departmentIds、roleIdsare all arrays; a single value must also be wrapped as an array.- Member-related
addIds/deleteIds/addNames/deleteNamesis a string array; account-relatedaccountChange.addIds/deleteIdsis also a string array. - New rule documentation description
userChange.addIdsanduserChange.addNameseither one can be passed; when both are passed, the union is taken. configs.functions.permissionCommon values:1allow,2allow and log,3restrict and log,6restrict.password、mouse_click、keyboard_inputOnly supports1、6。request_idwill be output by the CLI tometa.requestId; when troubleshooting interface issues, record this value first.