Add allowedUserGroup

@param UserGroup $allowedUserGroup

@return Form
961364
public function addAllowedUserGroup(UserGroup $allowedUserGroup)
    {
        if ($this->allowedUserGroups->contains($allowedUserGroup) === false) {
            $this->allowedUserGroups->add($allowedUserGroup);
        }

        return $this;
    }
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);
	}
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);
    }
247212
public function add($key, $callable = null)
    {
        if (null !== $callable) {
            $group = new PermissionGroup($callable);
            $group->key($key);

            $this->permissions->put($key, $group);
        } else {
            $group = new PermissionGroup();

            $group->key($key);
            $this->permissions->put($key, $group);
        }
        return $group;
    }
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);
    }
1360274
public function addUser(\Haven\SecurityBundle\Entity\User $users)
    {
        $this->users[] = $users;
    
        return $this;
    }
297130
public function add_userlist(userlist_base $userlist) : userlist_collection {
        $component = $userlist->get_component();
        if (isset($this->userlists[$component])) {
            throw new \moodle_exception("A userlist has already been added for the '{$component}' component");
        }

        $this->userlists[$component] = $userlist;

        return $this;
    }
675428
public function addUser($id, $userId)
    {
        $xml = new \SimpleXMLElement('<?xml version="1.0"?><user_id>'.$userId.'</user_id>');

        return $this->post('/groups/'.$id.'/users.xml', $xml->asXML());
    }
1357514
public static function block_user(int $userid, int $blockeduserid) {
        global $CFG, $USER;

        // Check if messaging is enabled.
        if (empty($CFG->messaging)) {
            throw new moodle_exception('disabled', 'message');
        }

        // Validate context.
        $context = context_system::instance();
        self::validate_context($context);

        $params = ['userid' => $userid, 'blockeduserid' => $blockeduserid];
        $params = self::validate_parameters(self::block_user_parameters(), $params);

        $capability = 'moodle/site:manageallmessaging';
        if (($USER->id != $params['userid']) && !has_capability($capability, $context)) {
            throw new required_capability_exception($context, $capability, 'nopermissions', '');
        }

        if (!\core_message\api::is_blocked($params['userid'], $params['blockeduserid'])) {
            \core_message\api::block_user($params['userid'], $params['blockeduserid']);
        }

        return [];
    }
1060505
protected function add_userids(array $userids) : userlist_base {
        $this->set_userids(array_merge($this->get_userids(), $userids));

        return $this;
    }
397367
public function add_users(array $userids) : userlist {
        global $DB;

        if (!empty($userids)) {
            list($useridsql, $useridparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
            $sql = "SELECT DISTINCT u.id
                      FROM {user} u
                     WHERE u.id {$useridsql}";
            $this->add_from_sql('id', $sql, $useridparams);
        }
        return $this;
    }
158967
public function addGroup($group)
    {
        if (null === $this->groups) {
            $this->groups = [];
        }
        if (!in_array($group, $this->groups)) {
            $this->groups[] = $group;
        }

        return $this;
    }
1011669
public function addGroup(GroupInterface $group)
    {
        if (!$this->hasGroup($group)) {
            $this->groups->set($group->getName(), $group);
            $group->addUser($this);
        }

        return $this;
    }
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());
        }
    }
943462
public function addUser(\FOM\UserBundle\Entity\User $user)
    {
        $this->users[] = $user;
        $user->addGroup($this);
        return $this;
    }
1209749
public function &addGroup($unshift = false)
    {
        $group = $this->factory->create('FormDesigner\FormGroup');

        if ($unshift == true) {
            array_unshift($this->groups, $group);
        }
        else {
            $this->groups[] = $group;
        }

        $group->injectFormDesigner($this);

        return $group;
    }
724981
public function addUser(ChildUser $user)
    {
        if ($this->collUsers === null) {
            $this->initUsers();
        }

        if (!$this->getUsers()->contains($user)) {
            // only add it if the **same** object is not already associated
            $this->collUsers->push($user);
            $this->doAddUser($user);
        }

        return $this;
    }