添加项目人员

OpenAPI 契约

方法
POST
路径
/api/v1/projects/{id}/people
认证
jwtBearer (bearer)
响应状态
201 400 401 403 404 409 429 500
请求与响应 Schema
JSON
{
  "requestBody": {
    "application/json": {
      "$ref": "#/components/schemas/UpsertProjectGrantRequest"
    }
  },
  "responses": {
    "201": {
      "description": "Project person added",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ProjectGrantResponse"
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "403": {
      "description": "Authenticated but not permitted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "404": {
      "description": "Requested project or build was not found",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    },
    "409": {
      "description": "Request conflicts with current project state",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    },
    "429": {
      "description": "HTTP rate limit or API-key NCU usage limit exceeded",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RateLimitError"
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

POST /api/v1/projects/{id}/people 仅限 JWT,并且需要项目管理能力。提交项目所在工作区中有效成员的 userId,以及角色:ADMIN、MAINTAINER、BUILDER、VIEWER 或 ARTIFACT_CONSUMER。

目标必须已经是有效工作区成员。用户不存在或不在该工作区时会报告未找到;已有直接授权会返回冲突。响应包含创建的授权。

json
{"userId":42,"role":"ARTIFACT_CONSUMER"}