Adds user group to promotion

@return bool Whether at least one promotion was added.
514274
public function addPromotionGroup()
    {
        $aChosenGroup = $this->_getActionIds('oxgroups.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sGroupTable = $this->_getViewName('oxgroups');
            $aChosenGroup = $this->_getAll($this->_addFilter("select $sGroupTable.oxid " . $this->_getQuery()));
        }

        $promotionAdded = false;
        if ($soxId && $soxId != "-1" && is_array($aChosenGroup)) {
            foreach ($aChosenGroup as $sChosenGroup) {
                $oObject2Promotion = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oObject2Promotion->init('oxobject2action');
                $oObject2Promotion->oxobject2action__oxactionid = new \OxidEsales\Eshop\Core\Field($soxId);
                $oObject2Promotion->oxobject2action__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenGroup);
                $oObject2Promotion->oxobject2action__oxclass = new \OxidEsales\Eshop\Core\Field("oxgroups");
                $oObject2Promotion->save();
            }

            $promotionAdded = true;
        }

        return $promotionAdded;
    }
329104
public function list_usergroups()
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $response = $this->exec_curl('/api/s/' . $this->site . '/list/usergroup');

        return $this->process_response($response);
    }
1101041
public function setUserGroups()
    {
        if ($this->_oGroups === null) {
            $this->_oGroups = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
            $this->_oGroups->init('oxgroups');
            $sViewName = getViewName("oxgroups");
            $sSelect = "select gr.* from {$sViewName} as gr, oxobject2group as o2g where
                         o2g.oxobjectid = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($this->getId()) . " and gr.oxid = o2g.oxgroupsid ";
            $this->_oGroups->selectString($sSelect);
        }

        return $this->_oGroups;
    }
16908
public function add()
    {
        $group = $this->UsersGroups->newEntity();

        if ($this->request->is('post')) {
            $group = $this->UsersGroups->patchEntity($group, $this->request->getData());

            if ($this->UsersGroups->save($group)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('group'));
    }
444306
private function addGroup($group)
	{
		if($group != null)
		{
			if($this->_groups == null)
				$this->_groups = array();
			$this->_groups[] = $group;
		}
	}
999119
protected function addgroup_privat24(){
		$this->registerGroup(BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24'),'privat24',array(
			new BConfigFieldInt(
				'PAYMENT_PRIVAT24_MERCHANT_ID',
				BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_ID')),
			new BConfigFieldString(
				'PAYMENT_PRIVAT24_MERCHANT_PASS',
				BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_PASS')),
			new BConfigFieldList(
				'PAYMENT_PRIVAT24_MERCHANT_CURRENCY',
				BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_CURRENCY'),
				array(
					'UAH'=>'UAH',
					'USD'=>'USD',
					'EUR'=>'EUR',
					)
				),
			new BConfigFieldList(
				'PAYMENT_PRIVAT24_MERCHANT_ISTEST',
				BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_ISTEST'),
				array(
					0=>BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_ISTEST_0'),
					1=>BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_ISTEST_1'),
					),
				0
				),

			));
		
		}
912765
def add_user_to_group(self, group_name, user_name):
        
        params = {'GroupName' : group_name,
                  'UserName' : user_name}
        return self.get_response('AddUserToGroup', params)
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()
1110893
public function addMember($groupId, $userId)
    {
        $exists = (bool)$this
            ->database
            ->query(
                "SELECT 1 FROM {ucms_group_access} WHERE group_id = :group AND user_id = :user",
                [':group' => $groupId, ':user' => $userId]
            )
            ->fetchField()
        ;

        if ($exists) {
            return false;
        }

        $this
            ->database
            ->merge('ucms_group_access')
            ->key([
                'group_id'  => $groupId,
                'user_id'   => $userId,
            ])
            ->execute()
        ;

        // @todo dispatch event

        $this->touch($groupId);

        $this->resetCache();

        return true;
    }
805223
public function AllowDiscountForNonUsers()
    {
        $bIsValid = true;
        $aExtranetGroup = $this->GetFieldDataExtranetGroupWithInverseEmptySelectionLogicIdList();
        if (null === $aExtranetGroup || count($aExtranetGroup) > 0) {
            $bIsValid = false;
        }

        if ($bIsValid) {
            $aExtranetUser = $this->GetFieldDataExtranetUserWithInverseEmptySelectionLogicIdList();
            if (null === $aExtranetUser || count($aExtranetUser) > 0) {
                $bIsValid = false;
            }
        }
        if ($bIsValid) {
            $aExtranetUserCountry = $this->GetMLTIdList('data_country_mlt');
            if (count($aExtranetUserCountry) > 0) {
                $bIsValid = false;
            }
        }

        return $bIsValid;
    }
557050
public function addGroup($group) {
    if (!$group->inArray((array) $this->groups)) {
      $this->groups[] = $group;
      return $this->groups;
    }
    return true;
  }
97056
protected function addCategoryGroup()
    {
        $this->controlAccess('category_group_add');

        if ($this->category_group->add($this->getSubmitted())) {
            $this->redirect('admin/content/category-group', $this->text('Category group has been added'), 'success');
        }

        $this->redirect('', $this->text('Category group has not been added'), 'warning');
    }
1092626
private function AddUserGroupField()
    {
        $name = 'UserGroup';
        $field = new Select($name, '');
        
        $field->AddOption('', Trans('Core.LayoutForm.NoGroup'));
        if ($this->layout->Exists() && $this->layout->GetUserGroup())
        {
            $field->SetValue($this->layout->GetUserGroup()->GetID());
        }
        DBSelectUtil::AddUserGroupOptions($field);
        $this->AddField($field);
    }
307748
public function addLDAPUserToGroup($userDn, $groupDn)
    {
        $members = $this->getLDAPGroupMembers($groupDn);

        // this user is already in the group, no need to do anything.
        if (in_array($userDn, $members)) {
            return;
        }

        $members[] = $userDn;

        try {
            $this->update($groupDn, ['member' => $members]);
        } catch (Exception $e) {
            throw new ValidationException('LDAP group membership add failure: ' . $e->getMessage());
        }
    }
618314
protected function checkUserGroup()
    {
        $isValid = true;

        $payPalPayment = $this->getPayment();
        $groups = $payPalPayment->getGroups();

        if ($groups && $groups->count() > 0) {
            $isValid = $this->isUserAssignedToGroup($groups);
        }

        return $isValid;
    }
646593
def add_user_to_group(self, user, group_name):
        
        group, _ = Group.objects.get_or_create(name = group_name)
        group.user_set.add(user)
1070295
public function addGroup(Group $group)
    {
        $this->hasGroupsProperty();

        if (!$this->groups->contains($group)) {
            $this->groups->add($group);
        }
    }