Hiện tại, các nhà phát triển đã có thể sử dụng rộng rãi tiện ích bổ sung của Google Lớp học! Vui lòng xem
tài liệu về tiện ích bổ sung để biết thêm thông tin.
Method: userProfiles.checkUserCapability
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trả về thông tin về việc người dùng có thể sử dụng chức năng Lớp học được chỉ định hay không. Ví dụ: bạn có thể dùng điểm cuối này để kiểm tra xem người dùng có thể tạo tệp đính kèm tiện ích bổ sung hay không.Người dùng yêu cầu chỉ có thể kiểm tra các chức năng cho chính mình.
Phương thức này trả về các mã lỗi sau:
PERMISSION_DENIED
nếu người dùng yêu cầu không được phép kiểm tra điều kiện cho người dùng được chỉ định.
INVALID_ARGUMENT
nếu yêu cầu sai định dạng.
Yêu cầu HTTP
GET https://classroom.googleapis.com/v1/userProfiles/{userId}:checkUserCapability
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Thông số |
userId |
string
Bắt buộc. Giá trị nhận dạng của người dùng. Khi được chỉ định làm tham số của một yêu cầu, giá trị nhận dạng này có thể là một trong những giá trị sau:
- giá trị nhận dạng dạng số cho người dùng
- địa chỉ email của người dùng
- giá trị cố định chuỗi
"me" , cho biết người dùng yêu cầu
|
Tham số truy vấn
Thông số |
capability |
enum (Capability )
Bắt buộc. Khả năng cần được kiểm tra đối với người dùng này. Ví dụ: để kiểm tra xem người dùng có thể tạo tệp đính kèm có tiện ích bổ sung hay không, hãy đặt giá trị này thành CREATE_ADD_ON_ATTACHMENT .
|
previewVersion |
enum (PreviewVersion )
Không bắt buộc. Phiên bản xem trước của API.
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Phản hồi từ việc kiểm tra các chức năng của người dùng.
Nếu thành công, phần nội dung phản hồi sẽ chứa dữ liệu có cấu trúc sau:
Biểu diễn dưới dạng JSON |
{
"capability": enum (Capability ),
"allowed": boolean
} |
Trường |
capability |
enum (Capability )
Chức năng của Lớp học.
|
allowed |
boolean
Người dùng có được phép sử dụng chức năng đã chỉ định hay không.
|
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
https://www.googleapis.com/auth/classroom.courses
https://www.googleapis.com/auth/classroom.courses.readonly
Để biết thêm thông tin, hãy xem Hướng dẫn uỷ quyền.
Chức năng
Enum đại diện cho khả năng.
Enum |
CAPABILITY_UNSPECIFIED |
Không được hỗ trợ. |
CREATE_ADD_ON_ATTACHMENT |
Khả năng tạo và sửa đổi AddOnAttachments được liên kết với dự án Developer Console của mã ứng dụng khách OAuth dùng để đưa ra yêu cầu. |
CREATE_RUBRIC |
Khả năng tạo và sửa đổi Phiếu chấm điểm. |
UPDATE_GRADING_PERIOD_SETTINGS |
Khả năng sửa đổi chế độ cài đặt giai đoạn chấm điểm. |
CREATE_STUDENT_GROUP |
Khả năng tạo và sửa đổi nhóm học viên cũng như thành viên của nhóm. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-06 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-06 UTC."],[],[],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. |"]]