Adds the group to the given user

@param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object
@param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
@param string $group Unique customer group code
433340
protected function addGroup( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group )
	{
		$msg = 'Add "%1$s" group to user "%2$s" for site "%3$s"';
		$this->info( sprintf( $msg, $group, $user->getCode(), $this->argument( 'site' ) ) );

		$groupItem = $this->getGroupItem( $context, $group );
		$this->addListItem( $context, $user->getId(), $groupItem->getId() );
	}
912532
public function set( \Aimeos\MShop\Common\Item\Iface $item )
	{
		$code = $item->getCode();

		if( !isset( $this->attributes[$code] ) || !is_array( $this->attributes[$code] ) ) {
			$this->attributes[$code] = [];
		}

		$this->attributes[$code][$item->getType()] = $item;
	}
475071
protected function getClient( \Aimeos\MShop\Context\Item\Iface $context )
	{
		if( !isset( $this->client ) ) {
			$this->client = \Aimeos\Client\Html\Email\Watch\Factory::create( $context );
		}

		return $this->client;
	}
14335
public static function get_users_in_context(userlist $userlist) {
        $context = $userlist->get_context();

        if (!$context instanceof \context_user) {
            return;
        }

        $userlist->add_user($context->instanceid);
    }
1038367
protected function _afterEntityInsert(AnCommandContext $context)
    {
        if ($this->isOwnable() && $this->owner->isNotifiable() && !$this->owner->eql($this->author)) {
            $this->addSubscriber($this->owner);
        } elseif (!empty($this->author)) {
            $this->addSubscriber($this->author);
        }
    }
1090458
protected function addItem( \Aimeos\MW\Container\Content\Iface $contentItem, \Aimeos\MShop\Product\Item\Iface $item, $langid )
	{
		$listTypes = [];
		foreach( $item->getListItems( 'text' ) as $listItem ) {
			$listTypes[$listItem->getRefId()] = $listItem->getType();
		}

		foreach( $this->getTextTypes( 'product' ) as $textTypeItem )
		{
			$textItems = $item->getRefItems( 'text', $textTypeItem->getCode() );

			if( !empty( $textItems ) )
			{
				foreach( $textItems as $textItem )
				{
					$listType = ( isset( $listTypes[$textItem->getId()] ) ? $listTypes[$textItem->getId()] : '' );
					$items = array( $langid, $item->getType(), $item->getCode(), $listType, $textTypeItem->getCode(), '', '' );

					// use language of the text item because it may be null
					if( ( $textItem->getLanguageId() == $langid || is_null( $textItem->getLanguageId() ) )
						&& $textItem->getTypeId() == $textTypeItem->getId() )
					{
						$items[0] = $textItem->getLanguageId();
						$items[5] = $textItem->getId();
						$items[6] = $textItem->getContent();
					}

					$contentItem->add( $items );
				}
			}
			else
			{
				$items = array( $langid, $item->getType(), $item->getCode(), 'default', $textTypeItem->getCode(), '', '' );
				$contentItem->add( $items );
			}
		}
	}
646593
def add_user_to_group(self, user, group_name):
        
        group, _ = Group.objects.get_or_create(name = group_name)
        group.user_set.add(user)
686761
public function addUser(User $user): bool
	{
		if(!$this->isPersisted)
		{
			throw new LogicException('You can only add a user to a group that exist in the database.');
		}

		if(!$user->isPersisted())
		{
			throw new LogicException('You can only add a user that exist in the database to a group.');
		}

		return $this->users()->link($user);
	}
878027
protected static function prepareContextForFixtures(Context $context, $group, $version)
    {
        if (!\is_null($version)) {
            $context->setVersion($version);
        }

        if (!\is_null($group)) {
            $context->setGroups([$group, Entity::GROUP_METADATA]);
        }

        return $context;
    }
1023384
public static function get( \Aimeos\MW\Config\Iface $config )
	{
		if( self::$context === null )
		{
			// TYPO3 specifc context with password hasher
			$context = new \Aimeos\MShop\Context\Item\Typo3();
			$context->setConfig( $config );

			self::addDataBaseManager( $context );
			self::addFilesystemManager( $context );
			self::addMessageQueueManager( $context );
			self::addLogger( $context );
			self::addCache( $context );
			self::addMailer( $context);
			self::addProcess( $context );
			self::addSession( $context );
			self::addHasher( $context);
			self::addUser( $context);
			self::addGroups( $context);

			self::$context = $context;
		}

		// Use local TS configuration from plugins
		self::$context->setConfig( $config );

		return self::$context;
	}
1215230
protected function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context )
	{
		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() );

		return $context->setMessageQueueManager( $mq );
	}
535920
protected static function addLogger( \Aimeos\MShop\Context\Item\Iface $context )
	{
		if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger'] )
			&& is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger'] ) )
		) {
			return $fcn( $context );
		}

		return $context->setLogger( \Aimeos\MAdmin::create( $context, 'log' ) );
	}
452349
protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context )
	{
		$dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() );

		return $context->setDatabaseManager( $dbm );
	}
408333
function group_add_user($group,$user){
        //adding a user is a bit fiddly, we need to get the full DN of the user
        //and add it using the full DN of the group
        
        //find the user's dn
        $user_info=$this->user_info($user,array("cn"));
        if ($user_info[0]["dn"]==NULL){ return (false); }
        $user_dn=$user_info[0]["dn"];
        
        //find the group's dn
        $group_info=$this->group_info($group,array("cn"));
        if ($group_info[0]["dn"]==NULL){ return (false); }
        $group_dn=$group_info[0]["dn"];
        
        $add=array();
        $add["member"] = $user_dn;
        
        $result=@ldap_mod_add($this->_conn,$group_dn,$add);
        if ($result==false){ return (false); }
        return (true);
    }
797473
public function addGroup(GroupInterface $group)
    {
        if (Credentials::check()) {
            RevisionRepository::create([
                'revisionable_type' => get_class($this),
                'revisionable_id'   => $this->getKey(),
                'key'               => 'added_group',
                'old_value'         => null,
                'new_value'         => $group->getName(),
                'user_id'           => Credentials::getUser()->id,
            ]);
        }

        return parent::addGroup($group);
    }
1238294
protected function addLogger( \Aimeos\MShop\Context\Item\Iface $context )
	{
		$logger = \Aimeos\MAdmin::create( $context, 'log' );

		return $context->setLogger( $logger );
	}
178818
public function member($group, $driver = null, $user = null)
	{
		$user = $user ?: $this->get_user_id();

		if ($driver === null)
		{
			foreach (\Auth::group(true) as $g)
			{
				if ($g->member($group, $user))
				{
					return true;
				}
			}

			return false;
		}

		return \Auth::group($driver)->member($group, $user);
	}