Manage Learn to apply best practices and optimize your operations.

@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.

Dig Deeper on Lotus Notes Domino Formula Language

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close