借助成员资格过期时间,群组所有者、群组管理员、Google Workspace 超级用户或具有群组管理员特权的工作区委托管理员可以管理群组和群组对资源的访问权限。访问权限可以根据成员资格过时情况或临时需求进行限制,而无需手动移出成员。Groups API 可针对以下用例启用成员资格过期时间:
对资源的限时访问权限(例如,允许某人帮助排查生产环境中的问题)
通信群组中的临时成员资格(例如,将人员临时加入一个长期项目的团队群组中)
如果所有类型的群组成员都具有 MEMBER 角色,则过期时间可以应用于这些成员(包括用户、群组和服务账号)。当您为本身就是群组的成员设置过期时间时,该过期时间会成为该群组的所有子级成员的默认过期时间,除非该子级成员在已经应用单个过期时间的父级群组中具有直接的成员资格。该过期时间以后也会应用于子级群组的所有新成员。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eThis feature enables managing group memberships with expiration dates, allowing for time-limited access to resources or temporary inclusion in communication groups.\u003c/p\u003e\n"],["\u003cp\u003eMembership expiration is applicable to users, groups, and service accounts with a \u003ccode\u003eMEMBER\u003c/code\u003e role, and when applied to a group, it becomes the default for all child members unless they have individual expirations.\u003c/p\u003e\n"],["\u003cp\u003eUpdating a membership's expiration requires calling \u003ccode\u003egroups.memberships.modifyMembershipRoles()\u003c/code\u003e and specifying the \u003ccode\u003eMEMBER\u003c/code\u003e role and its new expiration date.\u003c/p\u003e\n"],["\u003cp\u003eRetrieving a membership expiration is done by calling \u003ccode\u003egroups.memberships.get()\u003c/code\u003e with the parent group ID and the membership ID.\u003c/p\u003e\n"],["\u003cp\u003eGroup owners are automatically notified via email 72 hours before a membership expires, or immediately if the expiration is sooner than 72 hours.\u003c/p\u003e\n"]]],[],null,["# Managing membership expirations\n===============================\n\nThis page explains how to update and retrieve expiration settings for group\nmemberships, and the expiration notifications group owners receive.\n| **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education, and Cloud Identity Premium accounts.\n\nMembership expiration allows group owners, group managers, Google Workspace\nSuper Admins, or Workspace Delegated Admins with group admin privileges to\nmanage groups and groups-based access to resources. Access can be limited based\non membership staleness or temporary need without manually removing members.\nThe Groups API enables membership expiration for the following use cases:\n\n- Time-limited access to resources (for example, to allow someone to help troubleshoot a problem in production)\n- Temporary membership in a communications group (for example, to briefly include a person into a team group on a long-term project)\n\nExpirations can be applied to all types of group members (including users,\ngroups, and service accounts) if they have a `MEMBER` role. When you set an\nexpiration for a member that is a group, that expiration becomes the default\nexpiration for all child members of that group unless the child member has a\ndirect membership in the parent group with an individual expiration already\napplied. The expiration also applies to all new members of the child group\ngoing forward.\n\nBefore you begin\n----------------\n\nSet up authentication and install the client libraries. See\n[Setting up the Cloud Identity Groups API](/identity/docs/how-to/setup) to\nlearn how.\n\nAdding a membership with expiration\n-----------------------------------\n\nSee\n[Managing Google Group memberships for Google Groups](/identity/docs/how-to/memberships-google-groups)\nor\n[Managing identity-mapped group memberships](/identity/docs/how-to/memberships-identity-groups)\nto learn how.\n\nUpdating the expiration of a membership\n---------------------------------------\n\nTo update the expiration of a membership, call\n[`groups.memberships.modifyMembershipRoles()`](/identity/docs/reference/rest/v1/groups.memberships/modifyMembershipRoles)\nwith the ID of the parent group, the ID of the membership, and an\n[`UpdateMembershipRolesParams`](/identity/docs/reference/rest/v1beta1/groups.memberships/modifyMembershipRoles#updatemembershiprolesparams)\nresource. Because members can have more than one [`MembershipRole`](/identity/docs/reference/rest/v1beta1/groups.memberships#MembershipRole)\nin a group, you must specify which role will have the expiration. Currently\nonly the `MEMBER` role may have an expiration applied to it.\n| **Note:** To get the ID of the membership, call [groups.memberships.lookup()](/identity/docs/reference/rest/v1beta1/groups.memberships/lookup) with the ID of the parent group and the `memberKey` of the member.\n\n**Sample request body** \n\n {\n \"updateRolesParams\": [\n {\n \"fieldMask\": \"expiry_detail.expire_time\",\n \"membershipRole\": {\n \"expiryDetail\": {\n \"expireTime\": \"2021-10-02T15:01:23Z\"\n },\n \"name\": \"MEMBER\"\n }\n }\n ]\n }\n\nRetrieving a membership expiration\n----------------------------------\n\nTo retrieve the membership expiration of a membership, call\n[`groups.memberships.get()`](/identity/docs/reference/rest/v1/groups.memberships/get)\nwith the ID of the parent group and the ID of the membership.\n| **Note:** To get the ID of the membership, call [`groups.memberships.lookup()`](/identity/docs/reference/rest/v1beta1/groups.memberships/lookup) with the ID of the parent group and the `memberKey` of the member.\n\nEmail notifications\n-------------------\n\nEmail notifications are automatically sent to all group owners when memberships\nare about to expire. Notifications are sent 72 hours before expiration or\nimmediately if the membership will expire before 72 hours when it is set.\nThe notifications are sent in each group owner's preferred language, as defined\nby the domain administrator in the Google Admin console or by the group owner\nindividually."]]