In order to add the names of the current user's user roles to the body, you could use this script. It should be added right below the inclusion of mendix.js.
<script type="text/javascript">
(function() {
var classes = [];
dojo.connect(mx.ui, "startup", function() {
dojo.addOnLoad(function() {
var roles = mx.session.getUserRoles("Name");
for (var i = 0, role; role = roles[i++];) {
var claz = "role-" + role.toLowerCase();
dojo.addClass(document.body, claz);
classes.push(claz);
}
});
});
dojo.connect(mx, "logout", function() {
for (var i = 0, claz; claz = classes.pop();) {
dojo.removeClass(document.body, claz);
}
});
})();
</script>
This will add all user role names to the body (in lowercase, and with a 'role-' prefix to distinguish it from theme classes). Then you could do user role specific things such as
.role-administrator .MxClient_headerPane {
background-color: red;
}
Currently not possible without a proper custom widget. We are testing this for Mendix 3.0, the user role (ur_administrator e.g.) will be added to the body class. Feature request always helps.