Adds user group to delivery sets config
779394
public function addGroupToSet()
    {
        $aChosenCat = $this->_getActionIds('oxgroups.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // adding
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sGroupTable = $this->_getViewName('oxgroups');
            $aChosenCat = $this->_getAll($this->_addFilter("select $sGroupTable.oxid " . $this->_getQuery()));
        }
        if ($soxId && $soxId != "-1" && is_array($aChosenCat)) {
            foreach ($aChosenCat as $sChosenCat) {
                $oObject2Delivery = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oObject2Delivery->init('oxobject2delivery');
                $oObject2Delivery->oxobject2delivery__oxdeliveryid = new \OxidEsales\Eshop\Core\Field($soxId);
                $oObject2Delivery->oxobject2delivery__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenCat);
                $oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field("oxdelsetg");
                $oObject2Delivery->save();
            }
        }
    }
1219692
protected function setUserAndGroup()
    {
        if (!is_null($this->user)) {
            if (!is_null($this->group)) {
                $group_info = posix_getgrnam($this->user);
                $group_id = $group_info['gid'];
                if (!posix_setgid($group_id)) {
                    throw new \RuntimeException("set group failed");
                }
            }
            $user_info = posix_getpwnam($this->user);
            $user_id = $user_info["uid"];
            if (!posix_setuid($user_id)) {
                throw new \RuntimeException("set user failed");
            }
        }
    }
87522
def add_user_to_group(iam_client, user, group, quiet = False):
    
    if not quiet:
        printInfo('Adding user to group %s...' % group)
    iam_client.add_user_to_group(GroupName = group, UserName = user)
833334
def install_host(trg_queue, *hosts, **kwargs):
    '''  '''
    user = kwargs.pop('user', None)
    group = kwargs.pop('group', None)
    mode = kwargs.pop('mode', None)
    item_user = kwargs.pop('item_user', None)
    item_group = kwargs.pop('item_group', None)
    item_mode = kwargs.pop('item_mode', None)
    is_down = kwargs.pop('is_down', False)

    #set modes
    mode, user, group, item_user, item_group, item_mode =\
        _def_mode(mode, user, group, item_user, item_group, item_mode)
    uid, gid = uid_gid(user, group)
    host_path = fsq_path.hosts(trg_queue)
    try:
        _instdir(host_path, mode, uid, gid)
    except (OSError, IOError, ), e:
        if e.errno not in ( errno.EEXIST, errno.ENOTEMPTY, ):
            raise FSQInstallError(e.errno, wrap_io_os_err(e))
    if hosts:
        for host in hosts:
            host = fsq_path.valid_name(host)
            # uid_gid makes calls to the pw db and|or gr db, in addition to
            # potentially stat'ing, as such, we want to avoid calling it
            # unless we absoultely have to
            uid, gid = uid_gid(user, group)
            tmp_full, tmp_queue = _tmp_trg(host, host_path)
            try:
                # open once to cut down on stat/open for chown/chmod combo
                fd = os.open(tmp_full, os.O_RDONLY)
                try:
                    # always fchmod here as mkdtemp is different than normal
                    # mkdir
                    os.fchmod(fd, mode)
                    if -1 != uid or -1 != gid:
                        os.fchown(fd, uid, gid)
                finally:
                    os.close(fd)

                # bless our queue with its children
                _instdir(fsq_path.tmp(trg_queue, tmp_queue), mode, uid, gid)
                _instdir(fsq_path.queue(trg_queue, tmp_queue), mode, uid, gid)
                _instdir(fsq_path.done(trg_queue, tmp_queue), mode, uid, gid)
                _instdir(fsq_path.fail(trg_queue, tmp_queue), mode, uid, gid)

                # down via configure.down if necessary
                if is_down:
                    down_host(tmp_queue, host, user=item_user,
                              group=item_group, mode=item_mode)

                # atomic commit -- by rename
                os.rename(tmp_full, fsq_path.base(trg_queue, host))
            except (OSError, IOError, ), e:
                shutil.rmtree(tmp_full)
                if e.errno == errno.ENOTEMPTY:
                    raise FSQInstallError(e.errno, u'queue exists: {0}'.format(
                                          trg_queue))
                if isinstance(e, FSQError):
                    raise e
906724
def create(config, name, group, type):
        """"""
        if type not in ('user', 'service'):
            raise click.BadOptionUsage("--type must be 'user' or 'service'")
        client = Client()
        client.prepare_connection()
        user_api = API(client)
        group_api = GroupApi(client)
        user_api.create(name[0], name[1], group, type, group_api)
982422
def add_member_to_group(self, group_id, user_id):
        
        url = self.TEAM_MEMBERS_URL % (group_id, user_id)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.post_request()
540458
def by_user(config):
        """"""
        client = Client()
        client.prepare_connection()
        audit_api = API(client)
        CLI.parse_membership('Groups by User', audit_api.by_user())
1242689
def update_user_groups(self, user, claims):
        
        if settings.GROUPS_CLAIM is not None:
            # Update the user's group memberships
            django_groups = [group.name for group in user.groups.all()]

            if settings.GROUPS_CLAIM in claims:
                claim_groups = claims[settings.GROUPS_CLAIM]
                if not isinstance(claim_groups, list):
                    claim_groups = [claim_groups, ]
            else:
                logger.debug(
                    "The configured groups claim '{}' was not found in the access token".format(settings.GROUPS_CLAIM))
                claim_groups = []

            # Make a diff of the user's groups.
            # Removing a user from all groups and then re-add them would cause
            # the autoincrement value for the database table storing the
            # user-to-group mappings to increment for no reason.
            groups_to_remove = set(django_groups) - set(claim_groups)
            groups_to_add = set(claim_groups) - set(django_groups)

            # Loop through the groups in the group claim and
            # add the user to these groups as needed.
            for group_name in groups_to_remove:
                group = Group.objects.get(name=group_name)
                user.groups.remove(group)
                logger.debug("User removed from group '{}'".format(group_name))

            for group_name in groups_to_add:
                try:
                    if settings.MIRROR_GROUPS:
                        group, _ = Group.objects.get_or_create(name=group_name)
                        logger.debug("Created group '{}'".format(group_name))
                    else:
                        group = Group.objects.get(name=group_name)
                    user.groups.add(group)
                    logger.debug("User added to group '{}'".format(group_name))
                except ObjectDoesNotExist:
                    # Silently fail for non-existing groups.
                    pass
661562
def add(env, securitygroup_id, network_component, server, interface):
    """"""
    _validate_args(network_component, server, interface)

    mgr = SoftLayer.NetworkManager(env.client)
    component_id = _get_component_id(env, network_component, server, interface)

    ret = mgr.attach_securitygroup_component(securitygroup_id,
                                             component_id)
    if not ret:
        raise exceptions.CLIAbort("Could not attach network component")

    table = formatting.Table(REQUEST_COLUMNS)
    table.add_row([ret['requestId']])

    env.fout(table)
592873
def add_resourcegroupitems(scenario_id, items, scenario=None, **kwargs):

    
    user_id = int(kwargs.get('user_id'))

    if scenario is None:
        scenario = _get_scenario(scenario_id, user_id)

    _check_network_ownership(scenario.network_id, user_id)

    newitems = []
    for group_item in items:
        group_item_i = _add_resourcegroupitem(group_item, scenario.id)
        newitems.append(group_item_i)

    db.DBSession.flush()

    return newitems
290016
def add_user(config, group, username):
        """"""
        client = Client()
        client.prepare_connection()
        group_api = API(client)
        try:
            group_api.add_user(group, username)
        except ldap_tools.exceptions.NoGroupsFound:  # pragma: no cover
            print("Group ({}) not found".format(group))
        except ldap_tools.exceptions.TooManyResults:  # pragma: no cover
            print("Query for group ({}) returned multiple results.".format(
                group))
        except ldap3.TYPE_OR_VALUE_EXISTS:  # pragma: no cover
            print("{} already exists in {}".format(username, group))
646593
def add_user_to_group(self, user, group_name):
        
        group, _ = Group.objects.get_or_create(name = group_name)
        group.user_set.add(user)
844942
def add_member_to_group(self, group_id, member_id):
        
        route_values = {}
        if group_id is not None:
            route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
        if member_id is not None:
            route_values['memberId'] = self._serialize.url('member_id', member_id, 'str')
        self._send(http_method='PUT',
                   location_id='45a36e53-5286-4518-aa72-2d29f7acc5d8',
                   version='5.0-preview.1',
                   route_values=route_values)
421216
def user_add_to_group_action(model, request):
    
    group_id = request.params.get('id')
    if not group_id:
        group_ids = request.params.getall('id[]')
    else:
        group_ids = [group_id]
    try:
        user = model.model
        validate_add_users_to_groups(model, [user.id], group_ids)
        groups = user.root.groups
        for group_id in group_ids:
            groups[group_id].add(user.name)
        groups()
        model.parent.invalidate(user.name)
        localizer = get_localizer(request)
        message = localizer.translate(_(
            'added_user_to_group',
            default="Added user '${uid}' to group '${gid}'.",
            mapping={
                'uid': user.id,
                'gid': ', '.join(group_ids)
            }
        ))
        return {
            'success': True,
            'message': message
        }
    except ManageMembershipError as e:
        if e.reason is not LM_TARGET_GID_NOT_ALLOWED:
            raise Exception(u"Unknown ManageMembershipError reason.")
        localizer = get_localizer(request)
        message = localizer.translate(_(
            'lm_add_target_gid_not_allowed',
            default=(
                "Failed adding user '${uid}' to group '${gid}'. "
                "Manage membership denied for target group."
            ),
            mapping={
                'uid': user.id,
                'gid': e.data
            }
        ))
        return {
            'success': False,
            'message': message
        }
    except Exception as e:
        return {
            'success': False,
            'message': str(e)
        }
769371
function group(configSetters) {
  assertConfigSetters(configSetters)

  const pre = getHooks(configSetters, 'pre')
  const post = getHooks(configSetters, 'post')

  const groupBlock = context => config => invokeConfigSetters(configSetters, context, config)

  return Object.assign(groupBlock, { pre, post })
}
40038
def _UpdateUserGroups(self, user, groups):
    
    groups = ','.join(groups)
    self.logger.debug('Updating user %s with groups %s.', user, groups)
    command = self.usermod_cmd.format(user=user, groups=groups)
    try:
      subprocess.check_call(command.split(' '))
    except subprocess.CalledProcessError as e:
      self.logger.warning('Could not update user %s. %s.', user, str(e))
      return False
    else:
      self.logger.debug('Updated user account %s.', user)
      return True
761426
def addGroupsToKey(server, activation_key, groups):
    '''
    
    '''

    try:
        client, key = _get_session(server)
    except Exception as exc:
        err_msg = 'Exception raised when connecting to spacewalk server ({0}): {1}'.format(server, exc)
        log.error(err_msg)
        return {'Error': err_msg}

    all_groups = client.systemgroup.listAllGroups(key)
    groupIds = []
    for group in all_groups:
        if group['name'] in groups:
            groupIds.append(group['id'])

    if client.activationkey.addServerGroups(key, activation_key, groupIds) == 1:
        return {activation_key: groups}
    else:
        return {activation_key: 'Failed to add groups to activation key'}