Page 1 sur 1

Removing Enforce Consistent ACL

MessagePublié: 02 Jan 2008 à 15:25
par Michael DELIQUE
Code : Tout sélectionner
Function RemovingEnforceConsistentACL_API(wDb As NotesDatabase) As Integer
   
%REM
'Variables API pour la fonction RemovingEnforceConsistentACL_API
Declare Function NSFDbOpen Lib "nnotes.dll" (Byval pathName As String, hDB As Long) As Integer
Declare Function NSFDbReadACL Lib "nnotes.dll" (Byval hDB As Long, hACL As Long) As Integer
Declare Function ACLGetFlags Lib "nnotes.dll" (Byval hACL As Long, dwFlags As Long) As Integer
Declare Function ACLSetFlags Lib "nnotes.dll" (Byval hACL As Long, dwFlags As Long) As Integer
Declare Function NSFDbStoreACL Lib "nnotes.dll" (Byval hDB As Long, Byval hACL As Long, objectID As Long, method As Long) As Integer
Declare Function NSFDbClose Lib "nnotes.dll" (Byval hDB As Long) As Integer
%END REM
   
   'Déclaration Variables   
   
   Dim nbReturnValue As Long
   Dim nbHDB As Long
   Dim nbHACL As Long
   Dim nbFlag As Long
   Const ACL_UNIFORM_ACCESS = 1
   
   If wDB Is Nothing Then
      RemovingEnforceConsistentACL_API = False
      Exit Function
   End If
   
   nbReturnValue = NSFDbOpen(wDB.FilePath, nbHDB)
   nbReturnValue = NSFDbReadACL(nbHDB, nbHACL)
   nbReturnValue = ACLGetFlags(nbHACL, nbFlag)
   If nbFlag And ACL_UNIFORM_ACCESS Then
      nbFlag = nbFlag Xor ACL_UNIFORM_ACCESS
      nbReturnValue = ACLSetFlags(nbHACL, nbFlag)
      nbReturnValue = NSFDbStoreACL(nbHDB, nbHACL, 0, 0)
      RemovingEnforceConsistentACL_API = True
   Else
      RemovingEnforceConsistentACL_API = False
   End If
   nbReturnValue = NSFDbClose(nbHDB)
   
   Exit Function
ErreurHandle:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   RemovingEnforceConsistentACL_API = False
   Exit Function
End Function