Issue:
@UserRoles doesn't seem to be a function available in XPages JavaScript.
Workaround:
var uRoles:Array = database.queryAccessRoles(session.getEffectiveUserName());
@IsMember("[admin]", uRoles)
one line version:
context.getUser().getRoles().contains('[admin]');
This could be part of the code whether to hide a Delete button for a document on a Custom Control.
The entire button might look like:
<xp:button value="Delete" id="btncontact4">
<xp:this.rendered><![CDATA[#{javascript:var uRoles:Array = database.queryAccessRoles(session.getEffectiveUserName());
!doccontact1.isNewNote() && !doccontact1.isEditable() && (@IsMember("[admin]", uRoles));
}]]></xp:this.rendered><xp:eventHandler event="onclick" submit="true"
refreshMode="complete" id="eventHandler4">
<xp:this.action>
<xp:deleteDocument name="$$PreviousPage"
message="Your document has been deleted.">
</xp:deleteDocument>
</xp:this.action>
</xp:eventHandler>
</xp:button>
previous page
|