developerWorks  >  Lotus  >  Forums & community  >  Lotus Domino Document Manager (Domino.Doc) Forum

Lotus Domino Document Manager (Domino.Doc) Forum

developerWorks




Can anyone confirm this possible bug (or at least odd behaviour)?
Cesar Mugnatto 04/06/2005 12:25 AM
Applications development/customization 3.5 Windows 2000


I'm trying to see if the currently logged in user has Administrative rights in a cabinet. I wrote an agent that uses the Domino.Doc API to test but it seems to give me odd results. Whoever runs the agent always appears to have Administrator access even if the access has been set to something different in the cabinet. The agent writes the names of the users retrieved from the Cabinet's Security object. The last name written is the name of the logged in user and has a .Value of 3 (= Manager).

Below the row of equal signs is the agent - please try it and let me know if you get the same results.

Thanks.

===========================================================

'Check Security via DDOC API:

Option Public
Option Declare

Sub Initialize
'Declare all API objects as Variants
Dim theApi As Variant
Dim theLibrary As Variant
Dim theCabinets As Variant
Dim theCabinet As Variant
Dim theSecurity As Variant
Dim theUsers As Variant
Dim theUser As Variant
Dim i As Integer

'Create the Api object
Set theApi = CreateObject("DominoDoc.API")

'Set the login name and password (if using http protocol - see below)
'Call theApi.SetHttpLogin("User Name", "password")

'Get the Library object from the Api
'Set theLibrary = theApi.GetLibrary("http://host/LibraryLib.nsf")
Set theLibrary = theApi.GetLibrary("notes://DominoServer/LibraryLib.nsf")

'Get the Cabinets object from the Library
Set theCabinets = theLibrary.Cabinets

'Display message box with count
Msgbox ("Count: " & theCabinets.Count)

'If there are any cabinets, display message box with title of first cabinet
If theCabinets.Count > 0 Then
Set theCabinet = theCabinets.ItemByIndex(0)
Msgbox ("Accessing Cabinet: " & theCabinet.Title)

Set theSecurity = theCabinet.BinderSecurity
Msgbox ("Is " & theLibrary.CurrentUserName & " an administrator? " & theSecurity.IsAdministrator)

Set theUsers = theSecurity.Users
For i = 0 To theUsers.Count - 1
Set theUser = theUsers.ItemByIndex(i)
Print theUser.Value & " - " & theUser.Name
Next
End If
End Sub

Go back