LotusScript to C API Programming Guide

rtLib Domino Rich Text Management template
Home
Show details for ContentContent
Purchase
Ready-to-use samples
Show details for Online resourcesOnline resources
Forum
Links
Happy readers

Anonymous

login


 

Hosted by Prominic.NET, Inc.
Main topic: using ACLLookupAccess . . .

using ACLLookupAccess . . . (by Dallas Gimpel, 05/20/2005 05:53:12 PM)

Hi Normunds (and everyone else) -

I'm wondering if any of you guys have been able to use the ACLLookupAccess function from LotusScript. I realize there are "natively" LS options available but they have other dependencies that I'd rather avoid if possible (for instance, relying on the personal NAB vs the public NAB, requiring the "Enforce Consistent ACL..." database property to be enabled, etc). The behavior described in the API documentation (see http://www-12.lotus.com/ldd/doc/tools/c/6.5/api65ref.nsf/0/002f004c00e3006d85255e3e00725e02?OpenDocument) is precisely the behavior I'm after. Essentially, I'd like to extend the function below by using ACLLookupAccess in place of NSFDbAccessGet, but I can't seem to get the structs right for function. I've tried several variations, but the function always returns the default access level to the database, which tells me it's not finding the name I'm passing it. At least it doesn't crash :)

Public Function validateAccess(pndbSrc As NotesDatabase) As Boolean

'//   +++ GLOBAL VARIABLES +++

'//   Constants:

'//   LIB_NAME - name of this LS library

'//   

'//   Class instances:

'//   none

'//   

'//   Primitives:

'//   none

'//   

'//   12/14/2002 - Dallas Gimpel

'//   

'//   DESCRIPTION:

'//   This function validates the current user's access to a given database. If the access

'//   level returned by the API call is greater than or equal to the defined minimum access

'//   (see MINIMUM_AXS_LEVEL constant) the function returns true.

'//   

'//   INPUT:

'//   pndbSrc - NotesDatabase, handle to the current database

'//   

'//   OUTPUT:

'//   Function returns a Boolean - true if current user has the minimum required access

   

   On Error Goto errorHandler

   

   Const NO_ERROR = 0

   Const ACL_LEVEL_NOACCESS = 0 '// see acl.h - also NotesDatabase.QueryAccess

   Const ACL_LEVEL_DEPOSITOR = 1

   Const ACL_LEVEL_READER = 2

   Const ACL_LEVEL_AUTHOR = 3

   Const ACL_LEVEL_EDITOR = 4

   Const ACL_LEVEL_DESIGNER = 5

   Const ACL_LEVEL_MANAGER = 6

   Const MINIMUM_AXS_LEVEL = ACL_LEVEL_DESIGNER

   Dim lngHDb As Long

   Dim intRC As Integer

   Dim intAxsLevel As Integer

   Dim intFlags As Integer

   Dim strPath As String * 256

   Dim strErrTxt As String

   

   validateAccess = False

   

'//   Construct a database path.

   Call W32OSPathNetConstruct(0, pndbSrc.Server, pndbSrc.FilePath, strPath$)

   

'//   Get a handle to the database.

   intRC% = W32NSFDbOpen(strPath$, lngHDb&)

   If Not(intRC% = NO_ERROR) Then

      Call getAPIErrorDesc(intRC%, strErrTxt$)

      Error intRC%, strErrTxt$

   End If

   

'//   Check user's access and set return value.

   Call W32NSFDbAccessGet(lngHDb&, intAxsLevel%, intFlags%)

   validateAccess = (intAxsLevel% >= MINIMUM_AXS_LEVEL)

   

functionExit:

   If lngHDb& > 0 Then

      Call W32NSFDbClose(lngHDb&)

   End If

   Exit Function

   

errorHandler:

   Call processUIError(LIB_NAME)

   Resume functionExit

End Function

I don't think the problem lies here, but the function is declared as follows:

   Declare Private Function W32ACLLookupAccess Lib "nnotes" Alias "ACLLookupAccess" (

   Byval hACL As Long, _

   sName As ACLNamesTYPE, _

   retAccessLevel As Integer, _

   retPrivileges As Long, _

   retAccessFlags As Integer, _

   retHPrivNames As Long _

   ) As Integer

The latest variation (it's hard to remember what I have and haven't tried) of the structures is as follows:

   Private Type NamesListTYPE

      nameCount As Integer

   '   license(0 To 3) As Byte

      license(0 To 3) As Integer

      authenticated As Long

      users As String * 256

   End Type

   Private Type ACLNamesTYPE

      nameInfo As NamesListTYPE

      users As String * 256

      groups As String

   End Type

I'd really appreciate a little help. Thanks and sorry to be so verbose.

dgg