IsAdminReaderAuthor

IsAdminReaderAuthor

Messagepar Stephane Maillard » 01 Août 2005 à 13:30

[syntax="ls"]Const APIModule = "NNOTES" ' Windows



Const ACL_FLAG_ADMIN_READERAUTHOR = &H4000



Declare Private Function OSPathNetConstruct Lib APIModule Alias "OSPathNetConstruct" _

( Byval zP As Long, Byval S As String, Byval F As String, Byval N As String) As Integer

Declare Private Function NSFDbOpen Lib APIModule Alias "NSFDbOpen" _

( Byval P As String, hDB As Long) As Integer

Declare Private Function NSFDbClose Lib APIModule Alias "NSFDbClose" _

( Byval hDB As Long) As Integer

Declare Private Function NSFDbReadACL Lib APIModule Alias "NSFDbReadACL" _

( Byval hDB As Long, hA As Long) As Integer

Declare Private Function NSFDbStoreACL Lib APIModule Alias "NSFDbStoreACL" _

( Byval hDB As Long, Byval hA As Long, Byval zO As Long, Byval M As Long) As Integer

Declare Private Function ACLGetFlags Lib APIModule Alias "ACLGetFlags" _

( Byval hDB As Long, F As Long) As Integer

Declare Private Function ACLSetFlags Lib APIModule Alias "ACLSetFlags" _

( Byval hDB As Long, Byval F As Long) As Integer

Declare Private Function OSMemFree Lib APIModule Alias "OSMemFree" _

( Byval hM As Long) As Integer





Function IsAdminReaderAuthor(db As NotesDatabase, setting As Variant) As Variant

With db

np$ = Space(1024)

OSPathNetConstruct 0, .Server, .FilePath, np$

End With



Dim hDB As Long

NSFDbOpen np$, hDB

If hDB = 0 Then Exit Function



Dim hACL As Long

NSFDbReadACL hDB, hACL

If hACL = 0 Then Exit Function



ACLGetFlags hACL, f&

If Isnull(setting) Then

IsAdminReaderAuthor = Not ((f& And ACL_FLAG_ADMIN_READERAUTHOR) = 0)

Else

If setting Then

f& = f& Or ACL_FLAG_ADMIN_READERAUTHOR

Else

f& = f& And Not ACL_FLAG_ADMIN_READERAUTHOR

End If

ACLSetFlags hACL, f&

s% = NSFDbStoreACL(hDB, hACL, 0, 0)

IsAdminReaderAuthor = (s% = 0)

End If

OSMemFree hACL



NSFDbClose hDB

End Function[/syntax]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Retour vers API