vendredi 19 décembre 2014

Client side security trim DOM node



I know that you can apply security trimming to .aspx pages via the <SharePoint:SecurityTrimmedControl> control, but is there an equivalent way of security trimming dynamically generated DOM nodes - client-side only?


For example, I have a node being created from a function that will be injected into a SP.UI.ModalDialog object.



var modal = function (title) {
var container = document.createElement("div");
container.innerHTML = "This is something that should be security trimmed";
container.className = "button half bg-green";
container.id = "trim-this-mofo";
// how do you security trim the node created above?
var options = {
allowMaximize: false,
title: title,
html: container,
showClose: true,
width: 750
};
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
};


Again, this is client side only.








0 commentaires:

Enregistrer un commentaire