Method: members.hasMember
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.
Kiểm tra xem người dùng cụ thể có phải là thành viên của nhóm hay không. Thành viên có thể là trực tiếp hoặc lồng nhau, nhưng nếu lồng nhau, memberKey
và groupKey
phải là các thực thể trong cùng một miền hoặc lỗi Invalid input
sẽ được trả về. Để kiểm tra các thành viên lồng nhau bao gồm các thực thể bên ngoài miền của nhóm, hãy sử dụng phương thức checkTransitiveMembership()
trong API Nhóm Cloud Identity.
Yêu cầu HTTP
GET https://admin.googleapis.com/admin/directory/v1/groups/{groupKey}/hasMember/{memberKey}
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Thông số |
groupKey |
string
Xác định nhóm trong yêu cầu API. Giá trị này có thể là địa chỉ email, email đại diện hoặc mã nhận dạng duy nhất của nhóm.
|
memberKey |
string
Xác định thành viên người dùng trong yêu cầu API. Giá trị này có thể là địa chỉ email chính, bí danh hoặc mã nhận dạng duy nhất của người dùng.
|
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
Mẫu JSON cho phản hồi Has Member (Có thành viên) trong Directory API.
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 |
{
"isMember": boolean
} |
Trường |
isMember |
boolean
Chỉ có đầu ra. Xác định xem người dùng cụ thể có phải là thành viên của nhóm hay không. Thành viên có thể là trực tiếp hoặc lồng nhau.
|
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
https://apps-apis.google.com/a/feeds/groups/
https://www.googleapis.com/auth/admin.directory.group
https://www.googleapis.com/auth/admin.directory.group.member
https://www.googleapis.com/auth/admin.directory.group.member.readonly
https://www.googleapis.com/auth/admin.directory.group.readonly
Để biết thêm thông tin, hãy xem Hướng dẫn uỷ quyền.
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-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],[],null,["# Method: members.hasMember\n\nChecks whether the given user is a member of the group. Membership can be direct or nested, but if nested, the `memberKey` and `groupKey` must be entities in the same domain or an `Invalid input` error is returned. To check for nested memberships that include entities outside of the group's domain, use the [`checkTransitiveMembership()`](https://cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/checkTransitiveMembership) method in the Cloud Identity Groups API.\n\n### HTTP request\n\n`GET https://admin.googleapis.com/admin/directory/v1/groups/{groupKey}/hasMember/{memberKey}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-------------|------------------------------------------------------------------------------------------------------------------------------------|\n| `groupKey` | `string` Identifies the group in the API request. The value can be the group's email address, group alias, or the unique group ID. |\n| `memberKey` | `string` Identifies the user member in the API request. The value can be the user's primary email address, alias, or unique ID. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nJSON template for Has Member response in Directory API.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|---------------------------------|\n| ``` { \"isMember\": boolean } ``` |\n\n| Fields ||\n|------------|------------------------------------------------------------------------------------------------------------------------|\n| `isMember` | `boolean` Output only. Identifies whether the given user is a member of the group. Membership can be direct or nested. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://apps-apis.google.com/a/feeds/groups/`\n- `\n https://www.googleapis.com/auth/admin.directory.group`\n- `\n https://www.googleapis.com/auth/admin.directory.group.member`\n- `\n https://www.googleapis.com/auth/admin.directory.group.member.readonly`\n- `\n https://www.googleapis.com/auth/admin.directory.group.readonly`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]