Google Classroom 外掛程式現已全面開放開發人員使用!詳情請參閱
外掛程式說明文件。
Method: userProfiles.checkUserCapability
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
傳回使用者是否可使用指定的 Classroom 功能。舉例來說,這個端點可用於檢查使用者是否可以建立外掛程式附件。要求存取權的使用者只能查看自己的功能。
這個方法會傳回下列錯誤代碼:
PERMISSION_DENIED
如果要求的使用者無權檢查指定使用者的資格。
INVALID_ARGUMENT
:要求格式錯誤。
HTTP 要求
GET https://classroom.googleapis.com/v1/userProfiles/{userId}:checkUserCapability
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
userId |
string
必要欄位。使用者的 ID。 指定為要求參數時,這個 ID 可以是下列其中一項:
- 使用者的數字 ID
- 使用者的電子郵件地址
- 字串常值
"me" ,表示要求的使用者
|
查詢參數
參數 |
capability |
enum (Capability )
必要欄位。應為這位使用者檢查的功能。舉例來說,如要檢查使用者是否可以建立外掛程式附件,請將這個值設為 CREATE_ADD_ON_ATTACHMENT 。
|
previewVersion |
enum (PreviewVersion )
(選用步驟) API 的預覽版本。
|
回應主體
檢查使用者功能的回應。
如果成功,回應主體會含有以下結構的資料:
JSON 表示法 |
{
"capability": enum (Capability ),
"allowed": boolean
} |
欄位 |
capability |
enum (Capability )
Classroom 功能。
|
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 相關聯的 AddOnAttachments,該 ID 用於提出要求。 |
CREATE_RUBRIC |
建立及修改評量表的功能。 |
UPDATE_GRADING_PERIOD_SETTINGS |
修改評分週期設定的功能。 |
CREATE_STUDENT_GROUP |
建立及修改學生群組和成員。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-06 (世界標準時間)。
[null,null,["上次更新時間: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. |"]]