CRITICAL — Before starting, MUST first use the Read tool to read ../ziniao-shared/SKILL.md
Use Cases
- "Assign store permissions to a new employee"
- "Batch authorize stores to a certain employee"
- "New hire onboarding, need to authorize all stores"
Prerequisites
- apiKey already configured (
ziniao-cli config init)
Workflow
staff list ──► 找到目标员工 ID
account list ──► 找到目标店铺 ID 列表
│
├──► 对每个店铺:
│ api /superbrowser/rest/v1/erp/store/auth/add { storeIdList, staffId }
│
└──► 汇总授权结果
Step 1: Find the employee
# 按姓名查找
ziniao-cli staff list --name "张三" --format table
# 记录 userId
Step 2: Find the stores to authorize
# 列出所有店铺
ziniao-cli account list --format table --page-all
# 或按名称搜索
ziniao-cli account list --name "US" --format table
Step 3: Authorize one by one
For each store, execute:
ziniao-cli api /superbrowser/rest/v1/erp/store/auth/add \
--data '{"storeIdList":["<storeId>"],"staffId":"<staffId>"}'
Step 4: Verify
# 查看该员工已授权的店铺
ziniao-cli api /superbrowser/rest/v1/erp/user/stores \
--data '{"userId":"<userId>","page":1,"limit":10}'
Notes
- Authorization is a write operation; confirm the user's intent before executing
- If a large number of stores need to be authorized, it is recommended to first list the plan and confirm
- When authorization fails, log the error and continue to the next one
References
- ziniao-account — Account management
- ziniao-staff — Staff management
- ziniao-shared — Authentication and global parameters