此版本的 GitHub Enterprise Server 已于以下日期停止服务 2024-07-09. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持。
适用于安全管理器的 REST API 终结点
使用 REST API 管理组织中的安全管理器。
关于安全管理器
注意:安全经理角色处于公开测试阶段,可能会发生更改。
安全经理是组织级别的角色,组织所有者可以将其分配给组织中的任何团队。 应用后,该角色会授予团队中的每个成员查看整个组织的安全警报和管理代码安全设置的权限,以及对组织中所有存储库的读取权限。
List security manager teams
Lists teams that are security managers for an organization. For more information, see "Managing security managers in your organization."
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:org
scope to use this endpoint.
“List security manager teams”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
“List security manager teams”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List security manager teams”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/security-managers
Response
Status: 200
[
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos",
"parent": null
}
]
Add a security manager team
Adds a team as a security manager for an organization. For more information, see "Managing security for an organization for an organization."
The authenticated user must be an administrator for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the write:org
scope to use this endpoint.
“Add a security manager team”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
team_slug string 必须The slug of the team name. |
“Add a security manager team”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
204 | No Content |
409 | The organization has reached the maximum number of security manager teams. |
“Add a security manager team”的示例代码
请求示例
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/security-managers/teams/TEAM_SLUG
Response
Status: 204
Remove a security manager team
Removes the security manager role from a team for an organization. For more information, see "Managing security managers in your organization team from an organization."
The authenticated user must be an administrator for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:org
scope to use this endpoint.
“Remove a security manager team”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
team_slug string 必须The slug of the team name. |
“Remove a security manager team”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
204 | No Content |
“Remove a security manager team”的示例代码
请求示例
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/security-managers/teams/TEAM_SLUG
Response
Status: 204