Builds a UserPair given the related CMC data
556443
def add_list_data(data)
      raise symbol.to_s if data.nil?
      self.exchange_rate = data['price_usd'].to_f
      self.perchant_change_week = data['percent_change_7d'].to_f
      self.perchant_change_day = data['percent_change_24h'].to_f
    end
1189245
def main():
    
    startLogging(stdout)
    checker = InMemoryUsernamePasswordDatabaseDontUse()
    checker.addUser("testuser", "examplepass")
    realm = AdditionRealm()
    factory = CredAMPServerFactory(Portal(realm, [checker]))
    reactor.listenTCP(7805, factory)
    reactor.run()
1359525
protected void initCmsContextForUI(HttpServletRequest req, HttpServletResponse res, CmsUIServlet servlet)
    throws IOException, CmsException {

        // instantiate CMS context
        String originalEncoding = req.getCharacterEncoding();
        String referrer = req.getHeader("referer");
        boolean allowPrivilegedLogin = (referrer == null) || !referrer.contains(CmsWorkplaceLoginHandler.LOGIN_HANDLER);

        CmsObject cms = initCmsObject(req, res, allowPrivilegedLogin);
        servlet.setCms(cms);
        if (originalEncoding != null) {
            // getI18NInfo sets wrong encoding
            req.setCharacterEncoding(originalEncoding);
        }
    }
405219
def user_add_prj(self, *args, **kwargs):
        
        if not self.cur_user:
            return

        dialog = ProjectAdderDialog(user=self.cur_user)
        dialog.exec_()
        prjs = dialog.projects
        for prj in prjs:
            prjdata = djitemdata.ProjectItemData(prj)
            treemodel.TreeItem(prjdata, self.user_prj_model.root)
1170710
def create(self, data, *args, **kwargs):
        
        super(MambuUser, self).create(data)
        self['user'][self.customFieldName] = self['customInformation']
        self.init(attrs=self['user'])
1256667
def post(method, hmc, uri, uri_parms, body, logon_required,
             wait_for_completion):
        """"""
        assert wait_for_completion is True  # synchronous operation
        try:
            console = hmc.consoles.lookup_by_oid(None)
        except KeyError:
            raise InvalidResourceError(method, uri)
        check_required_fields(method, uri, body, ['name'])
        properties = copy.deepcopy(body)
        if 'type' in properties:
            raise BadRequestError(
                method, uri, reason=6,
                message="Type specified when creating a user role: {!r}".
                format(properties['type']))
        properties['type'] = 'user-defined'
        new_user_role = console.user_roles.add(properties)
        return {'object-uri': new_user_role.uri}
941201
public function buildData()
    {
        $token = $this->security->getToken();
        $user  = $token->getUser();

        if ($user instanceof UserInterface) {
            $user = $user->getUsername();
        }

        $tokenClass = is_object($token) ? get_class($token) : 'N/A';
        $userClass  = is_object($token->getUser()) ? get_class($token->getUser()) : 'N/A';

        $this->data = [
            'token'      => $token,
            'tokenClass' => $tokenClass,
            'user'       => $user,
            'userClass'  => $userClass
        ];
    }
790714
def post(method, hmc, uri, uri_parms, body, logon_required,
             wait_for_completion):
        """"""
        assert wait_for_completion is True  # synchronous operation
        user_role_oid = uri_parms[0]
        user_role_uri = '/api/user-roles/' + user_role_oid
        try:
            user_role = hmc.lookup_by_uri(user_role_uri)
        except KeyError:
            raise InvalidResourceError(method, uri)
        check_required_fields(method, uri, body,
                              ['permitted-object', 'permitted-object-type'])
        # Reject if User Role is system-defined:
        if user_role.properties['type'] == 'system-defined':
            raise BadRequestError(
                method, uri, reason=314, message="Cannot add permission to "
                "system-defined user role: {}".format(user_role_uri))
        # Apply defaults, so our internally stored copy has all fields:
        permission = copy.deepcopy(body)
        if 'include-members' not in permission:
            permission['include-members'] = False
        if 'view-only-mode' not in permission:
            permission['view-only-mode'] = True
        # Add the permission to its store (the faked User Role object):
        if user_role.properties.get('permissions', None) is None:
            user_role.properties['permissions'] = []
        user_role.properties['permissions'].append(permission)
152923
def prj_create_user(self, *args, **kwargs):
        
        if not self.cur_prj:
            return
        user = self.create_user(projects=[self.cur_prj])
        if user:
            userdata = djitemdata.UserItemData(user)
            treemodel.TreeItem(userdata, self.prj_user_model.root)
1160250
public void setupUserInfo()
    {
        MessageProcessInfo recMessageProcessInfo = null;
        try {
            Record recUser = this.getMainRecord();
            Object bookmark = recUser.getLastModified(DBConstants.BOOKMARK_HANDLE);
            recUser = recUser.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
            if ((recUser == null) ||
                (recUser.getEditMode() == DBConstants.EDIT_NONE) || (recUser.getEditMode() == DBConstants.EDIT_ADD))
                    return;     // Never
        
            Map<String, Object> properties = this.getSiteProperties();
            RunRemoteProcessMessageData createSiteRequest = this.setupUserProperties(properties);
        
            recMessageProcessInfo = new MessageProcessInfo(this);
            recMessageProcessInfo.setKeyArea(MessageProcessInfo.CODE_KEY);
            recMessageProcessInfo.getField(MessageProcessInfo.CODE).setString("RunRemoteProcessRQ");
            if (recMessageProcessInfo.seek(null))
            {
                TrxMessageHeader trxMessageHeader = recMessageProcessInfo.createProcessMessageHeader(null, MessageTransport.XML);
                if (trxMessageHeader == null)
                    return;
                trxMessageHeader.put(TrxMessageHeader.DESTINATION_PARAM, properties.get(TrxMessageHeader.DESTINATION_PARAM));
                trxMessageHeader.put(MessageTransport.MANUAL_RESPONSE_PARAM, DBConstants.TRUE);    // For testing, allow manual requests
                if (m_intRegistryID != null)
                    trxMessageHeader.put(TrxMessageHeader.REGISTRY_ID, m_intRegistryID);    // The return Queue ID
                BaseMessage message = createSiteRequest.getMessage();
                message.setMessageHeader(trxMessageHeader);
                if (!MessageTransport.DIRECT.equalsIgnoreCase((String)trxMessageHeader.get(MessageTransport.SEND_MESSAGE_BY_PARAM)))
                {
                    MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager();
                    if (messageManager != null)
                        messageManager.sendMessage(message);
                }
            }
        } catch (DBException ex) {
            ex.printStackTrace();
        } finally {
            recMessageProcessInfo.free();
        }
            
        synchronized (this)
        {
           try {
               waiting = true;
               this.wait(40000);
           } catch (InterruptedException ex) {
               ex.printStackTrace();
           }
           if (waiting)
               strMessage = "Error: Timeout on message call";
        }
    }
627116
def build_userlist(self, userlist_node):
        """"""
        proxy_name = userlist_node.userlist_header.proxy_name.text
        config_block_lines = self.__build_config_block(
            userlist_node.config_block)
        return config.Userlist(
            name=proxy_name,
            config_block=config_block_lines)
279010
def build_user_requested_parameters(request, meta):
    """"""

    postParameters = {}
    getParameters = {}
    files = {}

    # Add parameters requested by the server
    if 'user_info' in meta:
        for prop in meta['user_info']:

            # Test if the value exist, otherwise return None
            value = None
            if hasattr(request.user, prop) and prop in settings.PIAPI_USERDATA:
                value = getattr(request.user, prop)
            else:
                raise Exception('requested user attribute "%s", '
                                'does not exist or requesting is not allowed' % prop)

            # Add informations to get or post parameters, depending on the current method
            if request.method == 'POST':
                postParameters['ebuio_u_' + prop] = value
            else:
                getParameters['ebuio_u_' + prop] = value

    return (getParameters, postParameters, files)
1360581
def build(self, builder):
        """"""

        params = dict(
            OID=self.oid,
            Name=self.name,
            Repeating=bool_to_yes_no(self.repeating),
            IsReferenceData=bool_to_yes_no(self.is_reference_data),
        )

        if self.sas_dataset_name is not None:
            params["SASDatasetName"] = self.sas_dataset_name

        if self.domain is not None:
            params["Domain"] = self.domain

        if self.origin is not None:
            params["Origin"] = self.origin

        if self.role is not None:
            params["Role"] = self.role

        if self.purpose is not None:
            params["Purpose"] = self.purpose

        if self.comment is not None:
            params["Comment"] = self.comment

        builder.start("ItemGroupDef", params)

        for itemref in self.item_refs:
            itemref.build(builder)

        # Extensions always listed AFTER core elements
        for labelref in self.label_refs:
            labelref.build(builder)

        for alias in self.aliases:
            alias.build(builder)

        builder.end("ItemGroupDef")
552052
def template(cls, userdata):
        """"""
        ud = Userdata(cls.normalize(cls.create_empty(None), userdata))
        return ud
276355
public UserGroupCallback build() {
        UserGroupCallback callback = null;
        Properties properties = _propertiesBuilder.build();
        if (_userGroupCallbackClass != null) {
            callback = construct(properties);
        }
        if (callback == null && USER_CALLBACK_IMPL != null) {
            try {
                if ("props".equalsIgnoreCase(USER_CALLBACK_IMPL)) {
                    callback = new JBossUserGroupCallbackImpl(properties);
                } else {
                    callback = UserDataServiceProvider.getUserGroupCallback();
                }
            } catch (Throwable t) {
                // we might get here if on Karaf vs. JBoss
                // keep checkstyle happy ("at least one statement")
                t.getMessage();
            }
        }
        if (callback == null) {
            callback = new PropertiesUserGroupCallback(properties);
        }
        return callback;
    }
156726
def build(self, builder):
        """"""

        params = dict(
            OID=self.oid,
            Name=self.name,
            DataType=self.datatype.value,
            Length=str(self.length),
        )

        if self.date_time_format is not None:
            params["mdsol:DateTimeFormat"] = self.date_time_format

        params["mdsol:Active"] = bool_to_yes_no(self.active)

        if self.significant_digits is not None:
            params["SignificantDigits"] = str(self.significant_digits)

        if self.sas_field_name is not None:
            params["SASFieldName"] = self.sas_field_name

        if self.sds_var_name is not None:
            params["SDSVarName"] = self.sds_var_name

        if self.origin is not None:
            params["Origin"] = self.origin

        if self.comment is not None:
            params["Comment"] = self.comment

        if self.control_type is not None:
            params["mdsol:ControlType"] = self.control_type.value

        if self.acceptable_file_extensions is not None:
            params["mdsol:AcceptableFileExtensions"] = self.acceptable_file_extensions

        if self.default_value is not None:
            params["mdsol:DefaultValue"] = str(self.default_value)

        params["mdsol:SourceDocument"] = bool_to_yes_no(self.source_document_verify)
        params["mdsol:IndentLevel"] = str(self.indent_level)

        if self.sas_format is not None:
            params["mdsol:SASFormat"] = self.sas_format

        if self.sas_label is not None:
            params["mdsol:SASLabel"] = self.sas_label

        params["mdsol:QueryFutureDate"] = bool_to_yes_no(self.query_future_date)
        params["mdsol:Visible"] = bool_to_yes_no(self.visible)
        params["mdsol:TranslationRequired"] = bool_to_yes_no(self.translation_required)
        params["mdsol:QueryNonConformance"] = bool_to_yes_no(self.query_non_conformance)
        params["mdsol:OtherVisits"] = bool_to_yes_no(self.other_visits)
        params["mdsol:CanSetItemGroupDate"] = bool_to_yes_no(
            self.can_set_item_group_date
        )
        params["mdsol:CanSetFormDate"] = bool_to_yes_no(self.can_set_form_date)
        params["mdsol:CanSetStudyEventDate"] = bool_to_yes_no(
            self.can_set_study_event_date
        )
        params["mdsol:CanSetSubjectDate"] = bool_to_yes_no(self.can_set_subject_date)
        params["mdsol:VisualVerify"] = bool_to_yes_no(self.visual_verify)
        params["mdsol:DoesNotBreakSignature"] = bool_to_yes_no(
            self.does_not_break_signature
        )

        if self.field_number is not None:
            params["mdsol:FieldNumber"] = self.field_number

        if self.variable_oid is not None:
            params["mdsol:VariableOID"] = self.variable_oid

        builder.start("ItemDef", params)

        if self.question is not None:
            self.question.build(builder)

        if self.codelistref is not None:
            self.codelistref.build(builder)

        for mur in self.measurement_unit_refs:
            mur.build(builder)

        for range_check in self.range_checks:
            range_check.build(builder)

        if self.header_text is not None:
            self.header_text.build(builder)

        for view_restriction in self.view_restrictions:
            view_restriction.build(builder)

        for entry_restriction in self.entry_restrictions:
            entry_restriction.build(builder)

        for help_text in self.help_texts:
            help_text.build(builder)

        for review_group in self.review_groups:
            review_group.build(builder)

        for alias in self.aliases:
            alias.build(builder)

        builder.end("ItemDef")
1035249
private String buildClientVariantUrl(String context, CmsClientVariantInfo info) {

        String currentUrl = Window.Location.getHref();
        // remove fragment
        currentUrl = currentUrl.replaceFirst("#.*$", "");
        String connector = "?";
        if (currentUrl.indexOf('?') >= 0) {
            connector = "&";
        }
        String targetUrl = currentUrl + connector + CmsGwtConstants.PARAM_TEMPLATE_CONTEXT + "=" + context;
        return targetUrl;
    }