|
|
|
|
|
|
|
|
|
|
|
|
|
|
Who's on your ACL? (continued)
How the agent works Rather than make you wait until the end of the article to view the finished product, you can see a completed ACL Information Form in Figure A.
FIGURE A
 
Here you can view a completed ACL Information Form with the names changed to protect my life. Roll over picture for a larger image.
There are two basic parts to the agent:
- Use the ACL property of the Notes database class to go and get all of the ACL entries for a database and then sort them into arrays based on the level of access.
- Go through the seven arrays and check to see if any of the entries are groups in the PNAB (Personal Name and Address Book). If the entries are group names, the agent will retrieve the names from the Members field on the Group document and put that information on the ACL Information Form.
Once all of this information has been gathered it is saved to the appropriate fields on the ACL Information Form. This form includes two fields for each of the seven levels of access, one to store the raw names derived from the ACL list and one field to store the names of the members of each of the groups listed in the ACL at that access level. You can see all of this in Figure B.
FIGURE B
 
Here is screen shot of the ACL Information Form in design mode. Roll over picture for a larger image.
Better living through arrays The backbone of this agent is a technique that uses arrays to capture and methodically process the information contained in the ACL. Since this is such an important part of not only this agent but also programming in LotusScript in general, I'll explain how it works in more detail. For those of you that are experienced LotusScript programmers, you can skip this part if you like and go grab the sample database from http://dan.velasco.com.
Here is an analogy that describes how it all works. Picture seven buckets lined up in a row, each representing one of the seven levels of access in Notes/Domino. Now picture that you have a stack of index cards with a name written on each (either an individual name or a group name) and the level of access associated with that name. You throw one card at a time into the bucket that matches the access level written on the card.
The catch is that you need to always keep track of how many names are in each of the buckets. Therefore, you need a separate index number for each. And, once you've put an element into a bucket, you've got to do a ReDim Preserve on that array to both reset (ReDim) the number of elements in the array and save (Preserve) the elements you've already put in the array (or thrown in the bucket, if you will).
Let's take an example. The first entry in the ACL list you retrieve says "Donald Duck" and indicates he has manager access to the database. You then throw that entry into the Manager container (managerArray) and increase the index of that array by one. Next, you ReDim and Preserve all of the arrays and start all over again by analyzing the next entry in the ACL list.
Here is the code that does everything I've just described:
Dim managerArray(), designerArray(), editorArray(), authorArray(), readerArray(), depositorArray(), noaccessArray() As String
Dim mIndex, dIndex, eIndex, aIndex, rIndex, dpIndex, naIndex As Integer
mIndex = 0
dIndex = 0
eIndex = 0
aIndex = 0
rIndex = 0
dpIndex = 0
naIndex = 0
Do Until entry Is Nothing
'--Redimension Arrays
Redim Preserve managerArray(mIndex)
Redim Preserve designerArray(dIndex)
Redim Preserve editorArray(eIndex)
Redim Preserve authorArray(aIndex)
Redim Preserve readerArray(rIndex)
Redim Preserve depositorArray(dpIndex)
Redim Preserve noaccessArray(naIndex)
Dim entryName As String
Dim entryLevel As String
GetLevel% = entry.Level
entryLevel = LabelACLLevel(GetLevel%) '-LabelACLLevel is a function included in the agent code
entryName = entry.Name
'--Determine the access level of the entry and add it to the appropriate array,
'--increasing the index of that array when doing so.
Select Case entryLevel
Case "Manager"
managerArray(mIndex) = entryName
mIndex = mIndex + 1
Case "Designer"
designerArray(dIndex) = entryName
dIndex = dIndex + 1
Case "Editor"
editorArray(eIndex) = entryName
eIndex = eIndex + 1
Case "Author"
authorArray(aIndex) = entryName
aIndex = aIndex + 1
Case "Reader"
readerArray(rIndex) = entryName
rIndex = rIndex + 1
Case "Depositor"
depositorArray(dpIndex) = entryName
dpIndex = dpIndex + 1
Case "No Access"
noaccessArray(naIndex) = entryName
naIndex = naIndex + 1
End Select
Set entry = ACL.GetNextEntry(entry)
Loop
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.
Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.
Learn how to easily clean up your address book. |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|