Adds the `users` field to the organization model
507925
def update_org(cls, module):
        
        try:
            cls.module_registry[module]["OrgModel"]._meta.get_field("users")
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgModel"].add_to_class(
                "users",
                models.ManyToManyField(
                    USER_MODEL,
                    through=cls.module_registry[module]["OrgUserModel"].__name__,
                    related_name="%(app_label)s_%(class)s",
                ),
            )

        cls.module_registry[module]["OrgModel"].invitation_model = cls.module_registry[
            module
        ][
            "OrgInviteModel"
        ]
1324211
def update_org_owner(cls, module):
        
        try:
            cls.module_registry[module]["OrgOwnerModel"]._meta.get_field(
                "organization_user"
            )
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgOwnerModel"].add_to_class(
                "organization_user",
                models.OneToOneField(
                    cls.module_registry[module]["OrgUserModel"],
                    on_delete=models.CASCADE,
                ),
            )
        try:
            cls.module_registry[module]["OrgOwnerModel"]._meta.get_field("organization")
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgOwnerModel"].add_to_class(
                "organization",
                models.OneToOneField(
                    cls.module_registry[module]["OrgModel"],
                    related_name="owner",
                    on_delete=models.CASCADE,
                ),
            )
1158106
def activate_organizations(self, user):
        
        try:
            relation_name = self.org_model().user_relation_name
        except TypeError:
            # No org_model specified, raises a TypeError because NoneType is
            # not callable. This the most sensible default:
            relation_name = "organizations_organization"
        organization_set = getattr(user, relation_name)
        for org in organization_set.filter(is_active=False):
            org.is_active = True
            org.save()
240600
public void setupFields()
    {
        FieldInfo field = null;
        field = new FieldInfo(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field.setHidden(true);
        field = new FieldInfo(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Date.class);
        field.setHidden(true);
        field = new FieldInfo(this, DELETED, 10, null, new Boolean(false));
        field.setDataClass(Boolean.class);
        field.setHidden(true);
        field = new FieldInfo(this, USER_GROUP_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field = new FieldInfo(this, USER_RESOURCE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field = new FieldInfo(this, LOGIN_LEVEL, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field = new FieldInfo(this, ACCESS_LEVEL, Constants.DEFAULT_FIELD_LENGTH, null, null);
    }
1273248
def user_field_options(self, field_id, **kwargs):
        ""
        api_path = "/api/v2/user_fields/{field_id}/options.json"
        api_path = api_path.format(field_id=field_id)
        return self.call(api_path, **kwargs)
1188163
protected void addOrgUnitCondition(
        CmsSelectQuery select,
        TableAlias users,
        CmsOrganizationalUnit orgUnit,
        boolean recursive) {

        String ouName = orgUnit.getName();
        String pattern = CmsOrganizationalUnit.SEPARATOR + ouName;
        if (recursive) {
            pattern += "%";
        }
        select.addCondition(CmsDbUtil.columnLike(users.column(colOu()), pattern));
    }
1206871
public function addUserToSet()
    {
        $aChosenUsr = $this->_getActionIds('oxuser.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // adding
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sUserTable = $this->_getViewName('oxuser');
            $aChosenUsr = $this->_getAll($this->_addFilter("select $sUserTable.oxid " . $this->_getQuery()));
        }
        if ($soxId && $soxId != "-1" && is_array($aChosenUsr)) {
            foreach ($aChosenUsr as $sChosenUsr) {
                $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($sChosenUsr);
                $oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field("oxdelsetu");
                $oObject2Delivery->save();
            }
        }
    }
1352324
def add_current_user_is_applied_representation(func):
  
  @wraps(func)
  def _impl(self, instance):
    # We pop current_user_is_applied field to avoid AttributeError on default Serializer.to_representation
    ret = func(self, instance)

    user = self.context["request"].user
    applied = False
    if not user.is_anonymous():
      try:
        applied = models.Apply.objects.filter(user=user, project=instance).count() > 0
      except:
        pass

    ret["current_user_is_applied"] = applied

    return ret
  return _impl
560008
function(member) {
            users = $module.data('users');
            if(member.id != 'anonymous' && users[ member.id ] === undefined ) {
              users[ member.id ] = member.info;
              if(settings.randomColor && member.info.color === undefined) {
                member.info.color = settings.templates.color(member.id);
              }
              html = settings.templates.userList(member.info);
              if(member.info.isAdmin) {
                $(html)
                  .prependTo($userList)
                ;
              }
              else {
                $(html)
                  .appendTo($userList)
                ;
              }
              if(settings.partingMessages) {
                $log
                  .append( settings.templates.joined(member.info) )
                ;
                module.message.scroll.test();
              }
              module.user.updateCount();
            }
          }
493412
def update_users(self, entries):
        
        ws = IWorkspace(self.context)
        members = ws.members

        # check user permissions against join policy
        join_policy = self.context.join_policy
        if (join_policy == "admin"
            and not checkPermission(
                "collective.workspace: Manage roster",
                self.context)):
            raise Unauthorized("You are not allowed to add users here")

        for entry in entries:
            id = entry.get('id')
            is_member = bool(entry.get('member'))
            is_admin = bool(entry.get('admin'))

            # Existing members
            if id in members:
                member = members[id]
                if not is_member:
                    if checkPermission(
                            "ploneintranet.workspace: Manage workspace",
                            self.context):
                        ws.membership_factory(ws, member).remove_from_team()
                    else:
                        raise Unauthorized(
                            "Only team managers can remove members")
                elif not is_admin:
                    ws.membership_factory(ws, member).groups -= {'Admins'}
                else:
                    ws.membership_factory(ws, member).groups |= {'Admins'}

            # New members
            elif id not in members and (is_member or is_admin):
                groups = set()
                if is_admin:
                    groups.add('Admins')
                ws.add_to_team(user=id, groups=groups)
664756
def add_membership(self, name_or_org, role='member', **kwargs):
        
        if isinstance(name_or_org, Organization):
            membership = Membership(person_id=self._id,
                                    person_name=self.name,
                                    organization_id=name_or_org._id,
                                    role=role, **kwargs)
        else:
            membership = Membership(person_id=self._id,
                                    person_name=self.name,
                                    organization_id=_make_pseudo_id(name=name_or_org),
                                    role=role, **kwargs)
        self._related.append(membership)
        return membership
86459
function (userId, doc, fieldNames, modifier) {
			// only admins can update user roles via the client
			return Users.isAdmin(userId) || (doc._id === userId && fieldNames.indexOf("roles") < 0);
		}
22708
def update_org_invite(cls, module):
        
        try:
            cls.module_registry[module]["OrgInviteModel"]._meta.get_field("invited_by")
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgInviteModel"].add_to_class(
                "invited_by",
                models.ForeignKey(
                    USER_MODEL,
                    related_name="%(app_label)s_%(class)s_sent_invitations",
                    on_delete=models.CASCADE,
                ),
            )
        try:
            cls.module_registry[module]["OrgInviteModel"]._meta.get_field("invitee")
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgInviteModel"].add_to_class(
                "invitee",
                models.ForeignKey(
                    USER_MODEL,
                    null=True,
                    blank=True,
                    related_name="%(app_label)s_%(class)s_invitations",
                    on_delete=models.CASCADE,
                ),
            )
        try:
            cls.module_registry[module]["OrgInviteModel"]._meta.get_field(
                "organization"
            )
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgInviteModel"].add_to_class(
                "organization",
                models.ForeignKey(
                    cls.module_registry[module]["OrgModel"],
                    related_name="organization_invites",
                    on_delete=models.CASCADE,
                ),
            )
118972
private function AddEMailField()
    {
        $name = 'EMail';
        $this->AddField(Input::Text($name, $this->member->GetEMail()));
        $this->SetRequired($name);
        $this->AddValidator($name, PhpFilter::EMail());
        $this->AddValidator($name, DatabaseCount::UniqueField($this->member, $name));
    }
88869
def add_user(self, attrs):
        
        username = attrs[self.key]
        if username in self.users:
            raise UserAlreadyExists(username, self.backend_name)
        self.users[username] = attrs
        self.users[username]['groups'] = set([])
563359
def addUsersToRole(self, rolename, users):
        
        params = {
            "f" : "json",
            "rolename" : rolename,
            "users" : users
        }
        rURL = self._url + "/roles/addUsersToRole"
        return self._post(url=rURL, param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
319343
private function AddUserGroupField()
    {
        $name = 'UserGroup';
        $field = new Select($name, '');

        if ($this->Content()->Exists() && $this->Content()->GetUserGroup()) {
            $field->SetValue($this->Content()->GetUserGroup()->GetID());
        }

        $parentGroup = $this->FindParentGroup();
        $inheritGroupText = $parentGroup ? Trans('Core.ContentForm.UserGroup.Inherit_{0}', $parentGroup->GetName()) :
                Trans('Core.ContentForm.UserGroup.Inherit');

        $field->AddOption('', $inheritGroupText);

        DBSelectUtil::AddUserGroupOptions($field);
        $this->AddField($field, false, Trans('Core.ContentForm.UserGroup'));
    }