跳转到内容

cnb-rs repo member access

cnb-rs repo member access [USERNAME] [--include-inherit]

查看仓库权限信息。一个命令两种模式,按是否带 <USERNAME> 分支:

模式调用 API输出
不带 USERNAMEGET /{repo}/-/member/access-level当前用户的权限快照:等级 / 是否继承 / 读权限 / 写权限
带 USERNAMEGET /{repo}/-/members/{username}/access-level指定成员的权限层级表,含父组织继承路径

参数

  • [USERNAME]: 用户名(可选)。不指定则查看当前用户

选项

  • --include-inherit: 仅当不指定 USERNAME 时生效,让自己视图包含继承权限

继承的全局选项:

  • --repo <REPO>: 指定仓库路径
  • --json: JSON 输出
  • --domain <DOMAIN>: 指定目标域名

输出示例

不带 USERNAME(自己视图)

权限等级:  Owner
继承:
读权限:
写权限:

带 USERNAME(成员层级)

表格 2 列:

说明
PATH权限来源路径(当前仓库 / 父组织 / 祖先组织)
ACCESS LEVEL在该路径上的权限等级
PATH                            ACCESS LEVEL
wwvo                            Owner
wwvo/cnb-rs                     Owner
wwvo/cnb-rs/cli-dogfood         Owner

示例

bash
# 看自己在仓库的权限
cnb-rs --repo wwvo/cnb-rs/cli-dogfood repo member access

# 包含继承
cnb-rs --repo wwvo/cnb-rs/cli-dogfood repo member access --include-inherit

# 看 alice 在仓库的权限层级
cnb-rs --repo wwvo/cnb-rs/cli-dogfood repo member access alice

# JSON 输出(脚本里只取等级)
cnb-rs --repo wwvo/cnb-rs/cli-dogfood repo member access --json | jq -r '.access_level'

另请参阅

Released under the MIT License.