Method: members.hasMember
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בודק אם המשתמש הנתון הוא חבר בקבוצה. החברות יכולה להיות ישירה או בתצוגת עץ, אבל אם היא בתצוגת עץ, הערכים memberKey
ו-groupKey
חייבים להיות ישויות באותו דומיין, אחרת תוחזר השגיאה Invalid input
. כדי לבדוק אם יש חברויות בתצוגת עץ שכוללות ישויות מחוץ לדומיין של הקבוצה, משתמשים בשיטה checkTransitiveMembership()
ב-Cloud Identity Groups API.
בקשת HTTP
GET https://admin.googleapis.com/admin/directory/v1/groups/{groupKey}/hasMember/{memberKey}
כתובת ה-URL משתמשת בתחביר של Transcoding של gRPC.
פרמטרים של נתיב
פרמטרים |
groupKey |
string
מזהה את הקבוצה בבקשת ה-API. הערך יכול להיות כתובת האימייל של הקבוצה, כתובת האימייל החלופית של הקבוצה או מזהה הקבוצה הייחודי.
|
memberKey |
string
מזהה את חבר המועדון בבקשת ה-API. הערך יכול להיות כתובת האימייל הראשית, כתובת האימייל החלופית או המזהה הייחודי של המשתמש.
|
גוף הבקשה
גוף הבקשה חייב להיות ריק.
גוף התשובה
תבנית JSON לתגובה של Has Member ב-Directory API.
אם הפעולה מצליחה, גוף התגובה מכיל נתונים במבנה הבא:
ייצוג ב-JSON |
{
"isMember": boolean
} |
שדות |
isMember |
boolean
פלט בלבד. הפונקציה קובעת אם המשתמש מסוים הוא חבר בקבוצה. החברות יכולה להיות ישירה או מושתתת.
|
היקפי הרשאה
נדרש אחד מהיקפי ההרשאות הבאים של OAuth:
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
מידע נוסף זמין במדריך ההרשאות.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-25 (שעון UTC).
[null,null,["עדכון אחרון: 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)."]]