' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * ' * Checking users’ access rights ' * ' * sample code from ' * LotusScript to Lotus C API Programmer Guide by Normunds Kalnberzins, (c) 2000-2003 ' * ' * http://www.ls2capi.com ' * ' * Author: Normunds Kalnberzins ' * ' * This code has been written as a sample to illustrate aspects of handling of Lotus C API from LotusScript ' * and may be reused, modified on full responsibility of the developer and provided this notice is preserved ' * ' * The author does not guaranty it to fit any particular purpose and it is up to the developer ' * to modify, test it and determine the limits of its applicability ' * ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * * * * * * * * START (Type) [NAMES_LIST] ' * * * * * * * * ' * Public Type Names_List NumNames As Integer License (3) As Integer Authenticated (1) As Integer Users As String*256 End Type ' * * * * * * * * END (Type) [NAMES_LIST] ' * * * * * * * * ' * * * * * * * * START (Type) [ACLNAMES] ' * * * * * * * * ' * Public Type ACLNames NameInfo As Names_List Users As String*256 Groups As String End Type ' * * * * * * * * END (Type) [ACLNAMES] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_OSLOADSTRING] ' * * * * * * * * ' * Declare Sub W32_OSLoadString Lib "nnotes" Alias "OSLoadString" (Byval null1 As Long, Byval sError As Integer, Byval errstr As String, Byval lenstr As Integer) ' * * * * * * * * END (Declaration) [W32_OSLOADSTRING] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_NSFDBOPEN] ' * * * * * * * * ' * Declare Function W32_NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" (Byval PathName As LMBCS String, rethDB As Long) As Integer ' * * * * * * * * END (Declaration) [W32_NSFDBOPEN] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_NSFDBCLOSE] ' * * * * * * * * ' * Declare Function W32_NSFDbClose Lib "nnotes" Alias "NSFDbClose" (Byval hDB As Long) As Integer ' * * * * * * * * END (Declaration) [W32_NSFDBCLOSE] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_NSFDBREADACL] ' * * * * * * * * ' * Declare Function W32_NSFDbReadACL Lib "nnotes" Alias "NSFDbReadACL" (Byval hDB As Long , rethACL As Long) As Integer ' * * * * * * * * END (Declaration) [W32_NSFDBREADACL] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_ACLLOOKUPACCE ' * * * * * * * * ' * Declare Function W32_ACLLookupAccess Lib "nnotes" Alias "ACLLookupAccess" (Byval hACL As Long , sName As Lmbcs Names_List, retAccessLevel As Integer, retPrivileges As Long, retAccessFlags As Integer, rethPrivNames As Long) As Integer ' * * * * * * * * END (Declaration) [W32_ACLLOOKUPACCESS ' * * * * * * * * ' * * * * * * * * START (Method) [INITIALIZE] ' * * * * * * * * ' * Sub Initialize Dim session As New NotesSession Dim db As notesdatabase Dim myname As NotesName Dim hdb As Long Dim hacl As Long Dim Result As Integer Dim AccessLvl As Integer Dim Priv As Long Dim AccFlags As Integer Dim PrivNames As Long Dim ACLNameList As Names_List Dim server As String Dim filepath As String Dim irc As Integer Set db = session.currentdatabase Set myname = New NotesName(session.Username) ACLNameList.NumNames = 1 ACLNameList.Users = myname.Canonical & Chr(0) ' ACLNameList.Authenticated = 1 server = db.server filepath = db.filepath irc = W32_NSFDbOpen("names.nsf", hDB) If hdb=0 Then Print "Null handle":Exit Sub Print "Handle=", hdb irc% = W32_NSFDbReadACL(hDB, hACL) If hACL=0 Then Print "Null ACL handle", getError(irc%) W32_NSFDbClose(hdb) Exit Sub End If irc = W32_ACLLookupAccess(hACL, ACLNameList, AccessLvl, Priv, AccFlags, PrivNames) Print "access level = ",AccessLvl Call W32_NSFDbClose(hdb) End Sub ' * * * * * * * * END (Method) [INITIALIZE] ' * * * * * * * * %INCLUDE "C:\lss\capis\samples\Check access level\getError.lss" ' getError ' * * * * * * * * END (Function library) [CHECK ACCESS L ' * * * * * * * *