Resources
1Install
npx skillscat add riba2534/feishu-cli/feishu-cli-perm Install via the SkillsCat registry.
SKILL.md
飞书权限管理技能
为飞书云文档添加或更新协作者权限。
适用场景
- 给飞书文档添加协作者权限
- 批量授权脚本化
- 明确协作者类型、权限级别、是否通知
命令格式
添加权限
feishu-cli perm add <TOKEN> \
--doc-type <DOC_TYPE> \
--member-type <MEMBER_TYPE> \
--member-id <MEMBER_ID> \
--perm <PERM> \
[--notification]更新权限
feishu-cli perm update <TOKEN> \
--doc-type <DOC_TYPE> \
--member-type <MEMBER_TYPE> \
--member-id <MEMBER_ID> \
--perm <PERM>参数说明
doc-type(云文档类型)
| 值 | 说明 |
|---|---|
| docx | 新版文档 |
| doc | 旧版文档 |
| sheet | 电子表格 |
| bitable | 多维表格 |
| wiki | 知识库 |
| file | 文件 |
| folder | 文件夹 |
| mindnote | 思维笔记 |
| minutes | 妙记 |
| slides | 幻灯片 |
member-type(协作者 ID 类型)
| 值 | 说明 | 示例 |
|---|---|---|
| 邮箱 | user@example.com | |
| openid | Open ID | ou_xxx |
| unionid | Union ID | on_xxx |
| userid | User ID | 123456 |
| openchat | 群聊 ID | oc_xxx |
| opendepartmentid | 部门 ID | od_xxx |
| groupid | 群组 ID | gc_xxx |
| wikispaceid | 知识空间 ID | ws_xxx |
perm(权限角色)
| 值 | 说明 |
|---|---|
| view | 查看权限 |
| edit | 编辑权限 |
| full_access | 完全访问权限(可管理) |
可选参数
--notification:添加权限后通知对方
示例
按邮箱添加用户为编辑者
feishu-cli perm add docx_xxxxxx \
--doc-type docx \
--member-type email \
--member-id user@example.com \
--perm edit \
--notification按 Open ID 添加用户查看权限
feishu-cli perm add docx_xxxxxx \
--doc-type docx \
--member-type openid \
--member-id ou_xxxxxx \
--perm view给群聊添加编辑权限
feishu-cli perm add sht_xxxxxx \
--doc-type sheet \
--member-type openchat \
--member-id oc_xxxxxx \
--perm edit按部门添加查看权限
feishu-cli perm add sht_xxxxxx \
--doc-type sheet \
--member-type opendepartmentid \
--member-id od_xxxxxx \
--perm view更新已有权限
feishu-cli perm update docx_xxxxxx \
--doc-type docx \
--member-type email \
--member-id user@example.com \
--perm full_access执行流程
收集文档信息
- 获取文档 Token(从 URL 或用户提供)
- 确定 doc-type(根据 Token 前缀判断)
收集协作者信息
- 确定 member-type(邮箱最常用)
- 获取 member-id
选择权限级别
- view:仅查看
- edit:可编辑
- full_access:完全访问
执行命令
- 可选添加
--notification通知对方
- 可选添加
Token 前缀对应关系
| 前缀 | doc-type |
|---|---|
| docx_ | docx |
| doccn | doc |
| sht_ | sheet |
| bascn | bitable |
| wikicn | wiki |
| fldcn | folder |
常见默认操作
创建文档后自动授权:
# 创建文档后,给指定用户添加完全访问权限
feishu-cli perm add <doc_token> \
--doc-type docx \
--member-type email \
--member-id user@example.com \
--perm full_access \
--notification