Manage Learn to apply best practices and optimize your operations.

Check if user is part of a specific group

Often it is useful to check if the current user is a member of a specific group. The following subroutine allows you to do this.

View member feedback to this tip.

Often, it is useful to check if the current user is a member of a specific group. The following subroutine allows you to do this.

This is how you call it: if isGroupMember("Administrator")

The ACL property enforce consistent ACL must be checked. You can check roles surrounding the role name between [ ].

Code: Function isGroupMember(grpName As String)

Check if the current user is a member of the group passed as parameter.
Dim namesList
Dim i As Integer , res As Integer
 
namesList = Evaluate
({@UserNamesList})
 
For i = 0 To Ubound(namesList)
  If namesList(i) = grpName Then
   res = True
   Exit For
  End If
 Next
 
 isGroupMember = res
 
End Function

MEMBER FEEDBACK TO THIS TIP

This can be simplified further by using the following code:

Dim v as Variant  ' v must be 
of type Variant v = Evaluate({@Ismember
("Administrator"; @UserNamesList)})
 isGroupMember = v(0)

—Guy G.

******************************************

You can increase the performance if you use the ArrayGetIndex function.

—Eduardo A.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Thierry Seunevel. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close