This method will bind each users who don't already have an organization to the default one.
356622
public function bindUserToGroup()
    {
        $limit = 250;
        $offset = 0;
        $this->log('Add default group to users...');
        $this->objectManager->startFlushSuite();
        $countUsers = $this->objectManager->count('ClarolineCoreBundle:User');
        $default = $this->objectManager->getRepository(Group::class)->findOneByName(PlatformRoles::USER);
        $i = 0;

        while ($offset < $countUsers) {
            $users = $this->userRepo->findBy([], null, $limit, $offset);

            /** @var User $user */
            foreach ($users as $user) {
                if (!$user->hasGroup($default)) {
                    ++$i;
                    $this->log('Add default group for user '.$user->getUsername());
                    $user->addGroup($default);
                    $this->objectManager->persist($user);

                    if (0 === $i % 250) {
                        $this->log("Flushing... [UOW = {$this->objectManager->getUnitOfWork()->size()}]");
                        $this->objectManager->forceFlush();
                    }
                } else {
                    $this->log("group for user {$user->getUsername()} already exists");
                }
            }

            $this->log("Flushing... [UOW = {$this->objectManager->getUnitOfWork()->size()}]");
            $this->objectManager->forceFlush();
            $default = $this->objectManager->getRepository(Group::class)->findOneByName(PlatformRoles::USER);

            $offset += $limit;
        }

        $this->objectManager->endFlushSuite();
    }
1320046
def remove_users_from_organization(self, organization_id, users_list):
        
        log.warning('Removing users...')
        url = 'rest/servicedeskapi/organization/{}/user'.format(organization_id)
        data = {'usernames': users_list}

        return self.delete(url, headers=self.experimental_headers, data=data)
1180785
def update_org_users(cls, module):
        
        try:
            cls.module_registry[module]["OrgUserModel"]._meta.get_field("user")
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgUserModel"].add_to_class(
                "user",
                models.ForeignKey(
                    USER_MODEL,
                    related_name="%(app_label)s_%(class)s",
                    on_delete=models.CASCADE,
                ),
            )
        try:
            cls.module_registry[module]["OrgUserModel"]._meta.get_field("organization")
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgUserModel"].add_to_class(
                "organization",
                models.ForeignKey(
                    cls.module_registry[module]["OrgModel"],
                    related_name="organization_users",
                    on_delete=models.CASCADE,
                ),
            )
663927
def organization_memberships(self, user):
        
        return self._query_zendesk(self.endpoint.organization_memberships, 'organization_membership', id=user)
505772
def activate_users(server_context, target_ids, container_path=None):
    
    return __make_user_api_request(server_context, target_ids=target_ids, api='activateUsers.api',
                                   container_path=container_path)
856782
@SuppressWarnings("unchecked")
    private void bindUniqueSubConfigurations() {
        for (ConfigPath item : tree.getUniqueTypePaths()) {
            // bind only with annotation to avoid clashes with direct bindings
            toValue(
                    bind(Key.get(item.getDeclaredTypeWithGenerics(), Config.class)),
                    item.getValue());
        }
    }
327898
def merge_users(merge_to, merge_from):
    """"""
    # Determine most active user based on most recently created group
    assert(merge_to.username.endswith('umail.ucsb.edu'))

    # Merge groups
    for u2g in merge_from.groups_assocs[:]:
        merge_to.group_with(merge_from, u2g.project, bypass_limit=True)

    # merge classes and files
    merge_to.classes.extend(merge_from.classes)
    merge_to.files.extend(merge_from.files)

    # update file ownership
    for sub in Submission.query_by(created_by=merge_from).all():
        sub.created_by = merge_to

    # Delete the secondary user
    Session.delete(merge_from)
1278572
public void setDefaultUserSettings(CmsDefaultUserSettings defaultUserSettings) {

        m_defaultUserSettings = defaultUserSettings;

        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(
                Messages.get().getBundle().key(
                    Messages.INIT_DEFAULT_USER_SETTINGS_1,
                    m_defaultUserSettings.getClass().getName()));
        }
    }
189642
function(oldObserved, newObserveSet, onchanged) {
            for (var name in newObserveSet) {
                bindOrPreventUnbinding(oldObserved, newObserveSet, name, onchanged);
            }
        }
1024235
def reassign(self, user_ids, requester_id):
        
        if not user_ids:
            raise Error('Must pass at least one user id')
        self._do_action('reassign', requester_id=requester_id, assigned_to_user=','.join(user_ids))
20051
public function defaultSettings()
    {

        //Update the users first and last name
        if (!defined('AD_UPDATE_NAME')) {
            define('AD_UPDATE_NAME', true);
        }

        //Update the users email
        if (!defined('AD_UPDATE_EMAIL')) {
            define('AD_UPDATE_EMAIL', true);
        }

        //Update the users meta data
        if (!defined('AD_UPDATE_META')) {
            define('AD_UPDATE_META', true);
        }

        //Update the users meta data
        if (!defined('AD_META_PREFIX')) {
            define('AD_META_PREFIX', "ad_");
        }

        //Save the password entered by the user (this decreases the security)
        if (!defined('AD_SAVE_PASSWORD')) {
            define('AD_SAVE_PASSWORD', false);
        }

        //Create a random passowrd
        if (!defined('AD_RANDOM_PASSWORD')) {
            define('AD_RANDOM_PASSWORD', true);
        }

        //Bulk import off by default
        if (!defined('AD_BULK_IMPORT')) {
            define('AD_BULK_IMPORT', false);
        }

        //Bulk import default role
        if (!defined('AD_BULK_IMPORT_ROLE')) {
            define('AD_BULK_IMPORT_ROLE', "subscriber");
        }

        //Propagate role
        if (!defined('AD_BULK_IMPORT_PROPAGATE')) {
            define('AD_BULK_IMPORT_PROPAGATE', true);
        }

        //Activate cleaning actions
        if (!defined('AD_CLEANING')) {
            define('AD_CLEANING', true);
        }
    }
242488
protected function addDefaultRules()
    {
        if ($this->isProduction) {
            $this->collection->addUserAgentRules((new UserAgentRule('*'))->setAllow(['/']));
        } else {
            $this->collection->addUserAgentRules((new UserAgentRule('*'))->setDisallow(['/']));
        }
    }
228456
public static void setUpUsers() {
        LOG.info("SETTING UP THE USERS TO BE USED ");
        adminUser = userProps.getProperty("adminUsername");
        adminUserPassword = userProps.getProperty("adminPassword");
        LOG.info("COMPLETED USER SETUP ");
    }
194195
protected function bindEvents(): void
    {
        $userConfig = $this->app['config'][static::$abstract];

        $handler = new EventHandler($this->app->events, $userConfig);

        $handler->subscribe();

        $handler->subscribeQueueEvents($this->app->queue);

        if (isset($userConfig['send_default_pii']) && $userConfig['send_default_pii'] !== false) {
            $handler->subscribeAuthEvents();
        }
    }
867224
private function setMissingDefaults()
    {
        if (!isset($this->data['contenttype_groups'])) {
            $this->data['contenttype_groups'] = array('Content');
        }

        if ($this->notSetOrEmpty($this->data, 'names')) {
            $this->data['names'] = array(
                $this->data['main_language_code'] => $this->identifierToReadable($this->data['identifier']),
            );
        }

        foreach (array('name_schema', 'url_alias_schema') as $schema) {
            if ($this->notSetOrEmpty($this->data, $schema)) {
                $this->data[$schema] = sprintf('<%s>', $this->data['fields'][key($this->data['fields'])]->data['identifier']);
            }
        }
    }
742059
def _addUserToGroup(self, username, group="Clients"):
        
        portal_groups = api.portal.get_tool("portal_groups")
        group = portal_groups.getGroupById('Clients')
        group.addMember(username)
984394
protected function bindServices()
    {
        $reflection = new \ReflectionObject($this);
        $methods    = $reflection->getMethods();
        foreach ($methods as $method) {
            if ((strlen($method->name) > 10) && (strpos($method->name, 'initShared') === 0)) {
                $this->setShared(lcfirst(substr($method->name, 10)), $method->getClosure($this));
                continue;
            }
            if ((strlen($method->name) > 4) && (strpos($method->name, 'init') === 0)) {
                $this->set(lcfirst(substr($method->name, 4)), $method->getClosure($this));
            }
        }
    }