Update the Group memberships for the given users state
        :param user: User to update for
        :param state: State to update user for
        :return:
1857
def update_groups_for_user(self, user: User, state: State = None):
        
        if state is None:
            state = user.profile.state
        for config in self.filter(states=state):
            # grant user new groups for their state
            config.update_group_membership_for_user(user)
        for config in self.exclude(states=state):
            # ensure user does not have groups from previous state
            config.remove_user_from_alliance_groups(user)
            config.remove_user_from_corp_groups(user)
1202760
def save_state(internal_request, state):
        
        state_data = {"hash_type": internal_request.user_id_hash_type}
        state[UserIdHasher.STATE_KEY] = state_data
621976
def add_user(self, user, group):
        
        if self.is_user_in(user, group):
            raise UserAlreadyInAGroup
        self.new_groups.add(group, user)
1353285
def set_poolmember_state(self, id_pools, pools):
        

        data = dict()

        uri = "api/v3/pool/real/%s/member/status/" % ';'.join(id_pools)

        data["server_pools"] = pools

        return self.put(uri, data=data)
548077
def update_user(self, user, email=None, username=None,
            uid=None, defaultRegion=None, enabled=None):
        
        user_id = utils.get_id(user)
        uri = "users/%s" % user_id
        upd = {"id": user_id}
        if email is not None:
            upd["email"] = email
        if defaultRegion is not None:
            upd["RAX-AUTH:defaultRegion"] = defaultRegion
        if username is not None:
            upd["username"] = username
        if enabled is not None:
            upd["enabled"] = enabled
        data = {"user": upd}
        resp, resp_body = self.method_put(uri, data=data)
        if resp.status_code in (401, 403, 404):
            raise exc.AuthorizationFailure("You are not authorized to update "
                    "users.")
        return User(self, resp_body)
216115
def update_membership_users(self, user_id, group_id, moderator=None, workflow_state=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - group_id
        """ID"""
        path["group_id"] = group_id

        # REQUIRED - PATH - user_id
        """ID"""
        path["user_id"] = user_id

        # OPTIONAL - workflow_state
        """Currently, the only allowed value is "accepted""""
        if workflow_state is not None:
            self._validate_enum(workflow_state, ["accepted"])
            data["workflow_state"] = workflow_state

        # OPTIONAL - moderator
        """no description"""
        if moderator is not None:
            data["moderator"] = moderator

        self.logger.debug("PUT /api/v1/groups/{group_id}/users/{user_id} with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("PUT", "/api/v1/groups/{group_id}/users/{user_id}".format(**path), data=data, params=params, single_item=True)
489632
public function editYourOrganizationMembership(string $org, string $state = AbstractApi::STATE_ACTIVE): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org),
            Request::METHOD_PATCH, [
                'state' => $state
            ]);
    }
524592
def update_user(id, user, opts = {})
      data, _status_code, _headers = update_user_with_http_info(id, user, opts)
      return data
    end
950049
def add_group(group, user=None):
    
    user = get_user(user)

    if user is None:
        raise ValueError("User '{}' not found".format(repr(user)))

    if isinstance(group, basestring):
        group = [group]
    elif isinstance(group, GroupData):
        group = [group]

    portal_groups = get_tool("portal_groups")
    for group in map(get_group, group):
        if group is None:
            continue
        portal_groups.addPrincipalToGroup(get_user_id(user), group.getId())

    return get_groups(user)
120668
def update_group_admin(self, group_id, users=[]):
        
        data = {
            'groupId': group_id,
            'users': users,
        }
        return _fix_group(self.post('updateGroupAdmin', data))
623329
def get_user_groups(self, user):
        
        self.project_service.set_auth(self._token_project)
        return self.project_service.get_user_groups(user)
1119936
def check_membership(self, groups):
        '''  '''
        if not groups or groups == ['']:
            return True
        if self.request.user.is_superuser:
            return True
        user_groups = self.request.user.groups.values_list("name", flat=True)
        return set(groups).intersection(set(user_groups))
973259
def update_current_user(self, **params):
        """"""
        response = self._put('v2', 'user', data=params)
        return self._make_api_object(response, CurrentUser)
1007342
def cli(ctx, group_id, users=None):
    
    return ctx.gi.groups.update_group_admin(group_id, users=users)
1319497
def list_users
      update_users(:include_joins_and_parts) do
        users.values.each do |user|
          status = (user.idle? ? "G" : "H") + (user.admin? ? "@" : "")
          client.numeric_reply :rpl_whoreply, channel, user.account, user.server,
            "camper_van", user.nick, status, ":0 #{user.name}"
        end
        client.numeric_reply :rpl_endofwho, channel, "End of WHO list"
      end
    end
742059
def _addUserToGroup(self, username, group="Clients"):
        
        portal_groups = api.portal.get_tool("portal_groups")
        group = portal_groups.getGroupById('Clients')
        group.addMember(username)
973117
def cli(ctx, email, first_name, last_name, password, metadata={}):
    
    return ctx.gi.users.update_user(email, first_name, last_name, password, metadata=metadata)