https://developer.zendesk.com/rest_api/docs/core/group_memberships#set-membership-as-default
333888
def user_group_membership_make_default(self, user_id, membership_id, data, **kwargs):
        ""
        api_path = "/api/v2/users/{user_id}/group_memberships/{membership_id}/make_default.json"
        api_path = api_path.format(user_id=user_id, membership_id=membership_id)
        return self.call(api_path, method="PUT", data=data, **kwargs)
468958
def user_organization_membership_show(self, user_id, id, **kwargs):
        ""
        api_path = "/api/v2/users/{user_id}/organization_memberships/{id}.json"
        api_path = api_path.format(user_id=user_id, id=id)
        return self.call(api_path, **kwargs)
854209
def reset
      self.user_agent         = DEFAULT_USER_AGENT
      self.api_version        = DEFAULT_API_VERSION
      self.server_url         = DEFAULT_SERVER_URL
      self.client_name        = DEFAULT_CLIENT_NAME
      self.client_key         = DEFAULT_CLIENT_KEY
      self.connection_options = DEFAULT_CONNECTION_OPTIONS
      self.middleware         = DEFAULT_MIDDLEWARE
      self
    end
948154
def create_group_member(self, member):
        
        data = self._serialize_object(member)
        return Trigger(self._post(self._service_url(['triggers', 'groups', 'members']), data))
47758
private Collection<Membership> findMembershipsByGroup(Session session, Group group) throws Exception
   {
      Node groupNode;
      NodeIterator refUsers;
      try
      {
         groupNode = utils.getGroupNode(session, group);
         refUsers = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNodes();
      }
      catch (PathNotFoundException e)
      {
         return new ArrayList<Membership>();
      }

      List<Membership> memberships = new ArrayList<Membership>();
      while (refUsers.hasNext())
      {
         Node refUserNode = refUsers.nextNode();
         memberships.addAll(findMembershipsByUserAndGroup(session, refUserNode, groupNode));
      }

      return memberships;
   }
126077
def AddGroupMemberships(self):
    """"""
    self.groups = {g.name: self._Members(g) for g in itervalues(self.groups)}
    # Map the groups a user is a member of, irrespective of primary/extra gid.
    for g in itervalues(self.groups):
      for user in g.members:
        membership = self.memberships.setdefault(user, set())
        membership.add(g.gid)
    # Now add the completed membership to the user account.
    for user in itervalues(self.entry):
      user.gids = self.memberships.get(user.username)
20381
def reset
      self.user_agent         = DEFAULT_USER_AGENT
      self.environment        = DEFAULT_ENVIRONMENT
      self.api_version        = DEFAULT_API_VERSION
      self.server_url         = DEFAULT_SERVER_URL
      self.client_name        = DEFAULT_CLIENT_NAME
      self.client_key         = DEFAULT_CLIENT_KEY
      self.connection_options = DEFAULT_CONNECTION_OPTIONS
      self.middleware         = DEFAULT_MIDDLEWARE
      self.accept             = DEFAULT_ACCEPT
      self
    end
696542
def create_api_object_group_permission_general(self):
        """"""

        return ApiObjectGroupPermissionGeneral(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
1180105
function setDefaults ({ headers={}, overrideHeaders=false, ...rest }) {
  return {
    ...DEFAULTS,
    headers: overrideHeaders ? headers : { ...DEFAULT_HEADERS, ...headers },
    ...rest,
  }
}
1291562
def update_membership(self, group_id, users=[]):
        
        data = {
            'groupId': group_id,
            'users': users,
        }
        return _fix_group(self.post('updateMembership', data))
980172
def reset!
      self.api_username = DEFAULT_API_USERNAME
      self.api_key      = DEFAULT_API_KEY
      self.adapter      = DEFAULT_ADAPTER
      self.endpoint     = DEFAULT_ENDPOINT
      self.user_agent   = DEFAULT_USER_AGENT
      self.raise_errors = DEFAULT_RAISE_ERRORS
      self
    end
1267094
def create_group_groups(self, description=None, is_public=None, join_level=None, name=None, storage_quota_mb=None):
        
        path = {}
        data = {}
        params = {}

        # OPTIONAL - name
        """The name of the group"""
        if name is not None:
            data["name"] = name

        # OPTIONAL - description
        """A description of the group"""
        if description is not None:
            data["description"] = description

        # OPTIONAL - is_public
        """whether the group is public (applies only to community groups)"""
        if is_public is not None:
            data["is_public"] = is_public

        # OPTIONAL - join_level
        """no description"""
        if join_level is not None:
            self._validate_enum(join_level, ["parent_context_auto_join", "parent_context_request", "invitation_only"])
            data["join_level"] = join_level

        # OPTIONAL - storage_quota_mb
        """The allowed file storage for the group, in megabytes. This parameter is
        ignored if the caller does not have the manage_storage_quotas permission."""
        if storage_quota_mb is not None:
            data["storage_quota_mb"] = storage_quota_mb

        self.logger.debug("POST /api/v1/groups with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/groups".format(**path), data=data, params=params, single_item=True)
853435
def populate_with_defaults():
    '''
    '''
    logging.getLogger(__name__).debug("Populating with default users")
    if not User.select().where(User.name == 'admin').exists():
        admin = User.create(name='admin', password='admin')
        admins = Group.create(name='admins')
        starCap = Capability.create(domain='.+',
                                    action=(Action.CREATE |
                                            Action.READ |
                                            Action.UPDATE |
                                            Action.DELETE))
        admins.capabilities.add(starCap)
        admin.groups.add(admins)
        admin.save()
    if not User.select().where(User.name == 'anonymous').exists():
        anon = User.create(name='anonymous', password='')
        anons = Group.create(name='anonymous')
        readCap = Capability.create(domain=Capability.simToReg('/volumes/*'),
                                    action=Action.READ)
        anons.capabilities.add(readCap)
        anon.groups.add(anons)
        anon.save()
593409
def organization_organization_memberships(self, organization_id, **kwargs):
        ""
        api_path = "/api/v2/organizations/{organization_id}/organization_memberships.json"
        api_path = api_path.format(organization_id=organization_id)
        return self.call(api_path, **kwargs)
1078531
public function set_default(): void
    {
        if (!userHasPermission('admin:auth:groups:setDefault')) {
            show404();
        }

        $oUri            = Factory::service('Uri');
        $oUserGroupModel = Factory::model('UserGroup', 'nails/module-auth');
        $oSession        = Factory::service('Session', 'nails/module-auth');

        if ($oUserGroupModel->setAsDefault($oUri->segment(5))) {
            $oSession->setFlashData(
                'success',
                'Group set as default successfully.'
            );
        } else {
            $oSession->setFlashData(
                'error',
                'Failed to set default user group. ' . $oUserGroupModel->lastError()
            );
        }

        redirect('admin/auth/groups');
    }
1034975
def check_membership(user, group)
      raise JSS::NoSuchItemError, 'LDAPServer not yet saved in the JSS' unless @in_jss
      self.class.check_membership @id, user, group, api: @api
    end
1000654
def set_group_member_orphan(self, member_id):
        
        self._put(self._service_url(['triggers', 'groups', 'members', member_id, 'orphan']), data=None, parse_json=False)