imports/vx/client/code/ux.js
/**
     * Return an array of all users with the specified role suitable for populating a VXSelect
     * component.
     *
     * @param {string} tenant True to include users from the entire tenant.
     * @param {array} roleNames Optional array of role names to use as filter.
     * @return {array} Array of users bearing given role (prepared for <select>).
     */
Return an array of all users with the specified role suitable for populating a VXSelect
component.

@param {string} tenant True to include users from the entire tenant.
@param {array} roleNames Optional array of role names to use as filter.
@return {array} Array of users bearing given role (prepared for ).
Return an array of all users with the specified role suitable for populating a VXSelect component . @param { string } tenant True to include users from the entire tenant . @param { array } roleNames Optional array of role names to use as filter . @return { array } Array of users bearing given role ( prepared for ) .
makeUserArray(tenant, roleNames) {
        const criteria = {}
        criteria["profile.dateRetired"] = { $exists: false }
        if (tenant) {
            criteria["profile.domains"] = { $elemMatch: { domainId : { $in: Util.getDomainIdsOfCurrentTenant() } } }
        }
        else {
            criteria["profile.domains"] = { $elemMatch: { domainId : Util.getCurrentDomainId(Meteor.userId()) } }
        }
        let codeArray = []
        Meteor.users.find(criteria).forEach(user => {
            let qualified
            if (roleNames) {
                _.each(roleNames, roleName => {
                    if (Util.isUserRole(user._id, roleName)) {
                        qualified = true
                    }
                })
            }
            else {
                qualified = true
            }
            if (qualified) {
                const localized = Util.fetchFullName(user._id)
                codeArray.push( { code : user._id, localized : localized } )
            }
        })
        codeArray.sort((userA, userB) => {
            return Util.safeCompare(userA.localized, userB.localized)
        })
        return codeArray
    }
makeUserArray ( tenant , roleNames ) { const criteria = { } criteria [ "profile.dateRetired" ] = { $exists : false } if ( tenant ) { criteria [ "profile.domains" ] = { $elemMatch : { domainId : { $in : Util . getDomainIdsOfCurrentTenant ( ) } } } } else { criteria [ "profile.domains" ] = { $elemMatch : { domainId : Util . getCurrentDomainId ( Meteor . userId ( ) ) } } } let codeArray = [ ] Meteor . users . find ( criteria ) . forEach ( user => { let qualified if ( roleNames ) { _ . each ( roleNames , roleName => { if ( Util . isUserRole ( user . _id , roleName ) ) { qualified = true } } ) } else { qualified = true } if ( qualified ) { const localized = Util . fetchFullName ( user . _id ) codeArray . push ( { code : user . _id , localized : localized } ) } } ) codeArray . sort ( ( userA , userB ) => { return Util . safeCompare ( userA . localized , userB . localized ) } ) return codeArray }
Return an array of all users with the specified role suitable for populating a VXSelect
 component.
Return an array of all users with the specified role suitable for populating a VXSelect component .