@Userroles and multiple userroles
This tip descrbes a method for handling userroles.
We all know of using @userroles for hiding design elements using @Ismember or @Isnotmember. But @Isnotmember does not check for multiple roles. Here's an easier way.
<style type="text/css"><!-- .TPtext { color: #000000; background-color: #FFFFFF; } .TPkeyword1 { color: #0000FF; background-color: #FFFFFF; } .TPstring { color: #008080; background-color: #FFFFFF; } .TPbracket { color: #FF0000; background-color: #FFFFFF; } .TPoperator { color: #000000; background-color: #FFFFFF; } --></style> Suppose a field 'Status' has to be hidden to all except for people with roles "[Admin]" or "[Superuser]". This could be usually done by using <span class="TPtext"> <pre> @<span class="TPkeyword1"> Isnotmember</span><span class= "TPbracket">(</span><span class="TPstring">"[Admin]"</span>; @<span class="TPkeyword1">userroles </span><span class="TPbracket">) </span>| @ <span class="TPkeyword1">Isnotmember </span><span class="TPbracket">(</span> <span class="TPstring">"[Superuser]" </span>;@<span class="TPkeyword1">userroles </span><span class="TPbracket">)</span> </pre> Instead we could use the permutated equality on lists as follows: <pre> !<span class="TPbracket">( </span>@<span class="TPkeyword1"> userroles</span>*<span class="TPoperator">=</span> <span class="TPstring">"[Superuser]" </span><span class="TPoperator">:</span> <span class="TPstring">"[Admin]" </span><span class="TPbracket">)</span> </pre> </span> This is lot more readable and shorter.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Rajiv Menon. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.