Google 课堂插件现已面向开发者正式推出!如需了解详情,请参阅
插件文档。
Method: userProfiles.checkUserCapability
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
返回用户是否可以使用指定的 Google 课堂功能。例如,此端点可用于检查用户是否可以创建插件附件。请求用户只能查看自己的功能。
此方法会返回以下错误代码:
PERMISSION_DENIED
如果请求用户无权检查指定用户的资格。
- 如果请求格式不正确,则为
INVALID_ARGUMENT
。
HTTP 请求
GET https://classroom.googleapis.com/v1/userProfiles/{userId}:checkUserCapability
网址采用 gRPC 转码语法。
路径参数
参数 |
userId |
string
必需。用户的标识符。 当指定为请求的参数时,此标识符可以是以下值之一:
- 用户的数字标识符
- 用户的电子邮件地址
- 字符串字面量
"me" ,表示请求用户
|
查询参数
参数 |
capability |
enum (Capability )
必需。应针对相应用户检查的功能。例如,如需检查用户是否可以创建插件附件,请将此参数设置为 CREATE_ADD_ON_ATTACHMENT 。
|
previewVersion |
enum (PreviewVersion )
可选。API 的预览版。
|
响应正文
检查用户功能后的响应。
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"capability": enum (Capability ),
"allowed": boolean
} |
字段 |
capability |
enum (Capability )
Google 课堂功能。
|
allowed |
boolean
指定功能是否允许用户使用。
|
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/classroom.courses
https://www.googleapis.com/auth/classroom.courses.readonly
如需了解详情,请参阅授权指南。
能力
枚举 |
CAPABILITY_UNSPECIFIED |
不受支持。 |
CREATE_ADD_ON_ATTACHMENT |
创建和修改与用于发出请求的 OAuth 客户端 ID 的 Developer Console 项目相关联的 AddOnAttachments 的功能。 |
CREATE_RUBRIC |
创建和修改评分标准的权限。 |
UPDATE_GRADING_PERIOD_SETTINGS |
能够修改评分周期设置。 |
CREATE_STUDENT_GROUP |
创建和修改学生群组及其成员的功能。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-06。
[null,null,["最后更新时间 (UTC):2025-08-06。"],[],[],null,["# Method: userProfiles.checkUserCapability\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.CheckUserCapabilityResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Capability](#Capability)\n\n\u003cbr /\u003e\n\n| **Developer Preview:** Available as part of the [Google Workspace Developer Preview Program](https://developers.google.com/workspace/preview), which grants early access to certain features. This feature is available in [V1_20240930_PREVIEW](https://developers.google.com/workspace/classroom/reference/rest/v1/PreviewVersion) and later. See [Access Preview APIs](https://developers.google.com/workspace/classroom/reference/preview) to learn more.\nReturns whether a user may use the specified Classroom capability. For example, this endpoint can be used to check whether a user may create add- on attachments.\n\n\u003cbr /\u003e\n\nA requesting user can only check capabilities for themselves.\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` if the requesting user is not permitted to check eligibility for the specified user.\n- `INVALID_ARGUMENT` if the request is malformed.\n\n### HTTP request\n\n`GET https://classroom.googleapis.com/v1/userProfiles/{userId}:checkUserCapability`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `userId` | `string` Required. Identifier of the user. When specified as a parameter of a request, this identifier can be one of the following: - the numeric identifier for the user - the email address of the user - the string literal `\"me\"`, indicating the requesting user |\n\n### Query parameters\n\n| Parameters ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `capability` | `enum (`[Capability](/workspace/classroom/reference/rest/v1/userProfiles/checkUserCapability#Capability)`)` Required. The Capability that should be checked for this user. For example, to check whether a user can create an [add-on attachment](https://developers.google.com/workspace/classroom/reference/rest/v1/courses.courseWork.addOnAttachments#resource:-addonattachment), set this to `CREATE_ADD_ON_ATTACHMENT`. |\n| `previewVersion` | `enum (`[PreviewVersion](/workspace/classroom/reference/rest/v1/PreviewVersion)`)` Optional. The preview version of the API. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nResponse from checking user capabilities.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"capability\": enum (/workspace/classroom/reference/rest/v1/userProfiles/checkUserCapability#Capability), \"allowed\": boolean } ``` |\n\n| Fields ||\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| `capability` | `enum (`[Capability](/workspace/classroom/reference/rest/v1/userProfiles/checkUserCapability#Capability)`)` The Classroom capability. |\n| `allowed` | `boolean` Whether the specified capability is allowed for the user. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/classroom.courses`\n- `\n https://www.googleapis.com/auth/classroom.courses.readonly`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nCapability\n----------\n\nEnum to represent the capability.\n\n| Enums ||\n|----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `CAPABILITY_UNSPECIFIED` | Not supported. |\n| `CREATE_ADD_ON_ATTACHMENT` | The capability to create and modify AddOnAttachments associated with the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to make the request. |\n| `CREATE_RUBRIC` | The capability to create and modify Rubrics. |\n| `UPDATE_GRADING_PERIOD_SETTINGS` | The capability to modify grading period settings. |\n| `CREATE_STUDENT_GROUP` | The capability to create and modify student groups and their members. |"]]