SnTT: @ServerAccess in LotusScript


You can use @ServerAccess to check if a specified user has a specified administrative access level to a server. For a list of keywords to represent the access level you want to check for take a look at the designer help either on your local client or on the web.

But what to do if you want to check the server access level using Lotus Script? The help document does not give you a cross reference to Lotusscript.

In this case, the Evaluate statement is your friend.
For further information about how to use Evaluate I recommend to read the following article on DeveloperWorks: “Simplifying your LotusScript with the Evaluate statement

The following function uses evaluate and @ServerAccess to make the @function available in LotusScript.

Function atServerAccess ( 
sAction As String, sUserName As String, sServerName As String ) As Boolean
  Dim vAccess As Variant
  vAccess = 
   Evaluate(|@ServerAccess(| + sAction + |; "| + sUserName_
                + |"; "| + sServerName + |")|)	atServerAccess = Cbool(vAccess(0))
End Function

Here is a sample of how to call the function

Sub Click(Source As Button)
  Dim sUser As String
  Dim sServer As String
  Dim sAction As String
  sUser = "Bill Gates/Microsoft"
  sServer = "MyServer/foo"
  sAction = "[RemoteAccess]"

  ' returns TRUE of FALSE
  Msgbox atServerAccess ( sAction, sUser, sServer )
End Sub