Customize Settings for Mashups

Apply Mashup to selected Users

It is possible to apply a mashup only to users with selected numeric IDs or to ones having specified Default Role. The code fragment below illustrates the basics.

šŸš§

Default Role may differ from Role in Project or Team

More information: Default Role

var applyTo = {
    roleNames: ["Developer", "Project Manager"],
    userIds: [14, 29, 58]
};

tau.mashups
.addMashup(function() {
    var loggedUser = window.loggedUser || {};
    var isApplied = _.contains(applyTo.roleNames, loggedUser.role) || _.contains(applyTo.userIds, loggedUser.id);

    if (isApplied) {
        //write your custom code here
        console.log("Mashup applied to a logged user");
    }
});

Ability to restrict mashup from using cookies of the logged user

Sometimes you need mashup to send POST queries on behalf of the system user that can be done only using token. You can use the "omit" parameter for credentials in order to do it.

let ajaxUrl = apiRoot + " "  + "?token=" + systemUserToken;
fetch(ajaxUrl, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: " ",
    credentials: 'omit'
});