Search DominoPower's 11,433 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Managing database ACLs from a browser (continued)

Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim acl As NotesACL
Dim acle As NotesACLEntry
Set db = session.CurrentDatabase
Set doc = session.DocumentContext

REM Get the required global entries from the ACL object and put them on the form
Set acl = db.ACL
Call doc.ReplaceItemValue("mxInet", acl.InternetLevel)
Call doc.ReplaceItemValue("dbroles",acl.Roles)

REM get the first username on the ACL
Set acle = acl.GetFirstEntry

REM start list of all the names on the ACL
nlist = acle.Name
Set acle = acl.GetNextEntry(acle)

REM get username selected before form reloaded & this agent was called
formSelectName = doc.getitemvalue("name")(0)

REM cycle through each entry in the database ACL
While (Not acle Is Nothing)
REM get username
tname = acle.Name
REM append name to list & use same delimiter from ACL form "users" field choices
nlist = nlist +"*!*"+tname
REM if this username is the same as the one selected on the form then get all its data
If acle.Name = formSelectName Then
Call doc.ReplaceItemValue("usrRoles",acle.Roles)
Call doc.ReplaceItemValue("usrType", acle.UserType)
Call doc.ReplaceItemValue("usrLevel",acle.Level)
REM the following user properties correspond to the choices in the "usrprops" field
If acle.CanCreateDocuments = True Then props = props+"CRD "
If acle.CandeleteDocuments = True Then props = props+"DLD "
If acle.CanreplicateorcopyDocuments = True Then props = props+"CD "
If acle.ispublicreader = True Then props = props+"RPD "
If acle.ispublicwriter = True Then props = props+"WPD "
REM the following line turns the props variable into a text array
props = Evaluate("@Explode({"+props+"}{ })")
REM set the usrprops field with the values from the array
Call doc.ReplaceItemValue("usrprops",props)
End If

REM get the next ACL entry to process
Set acle = acl.getnextentry(acle)
Wend

REM put the names of all the ACL entries in the acles field
Call doc.ReplaceItemValue("acles",nlist)

The code is pretty well documented so I won't go into specifics, but basically it cycles through all the entries on the ACL and collects their names to populate the "users" field choices on the ACL form. It also gets the names of all the database roles, and checks to see if a user has been selected in the "users" field. If so, when the script comes across its ACL entry, it copies all the data to the form fields.

The next agent is the "AddACLUsr" agent, which adds new users to the ACL. The code for the agent is as follows:

Sub Initialize
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim acl As NotesACL
Dim acle As NotesACLEntry
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
Set acl = db.ACL

REM Create new ACL Entry with data from form
nUser = doc.GetItemValue("newUser")(0)
uLvl = doc.GetItemValue("usrlevel")(0)
Set acle = acl.CreateACLEntry(nUser, uLvl)

REM set the new entry's ACL user type
uType = doc.GetItemValue("usrType")(0)
acle.UserType = uType

REM Cycle & set ACL Entry Roles
uRoles = doc.GetItemValue("usrRoles")
Forall x In uRoles
acle.EnableRole(x)
End Forall

REM Cycle & select ACL Entry Properties.
uProps = doc.GetItemValue("usrProps")
Forall x In uProps
Select Case x
Case "CRD"
acle.cancreatedocuments = True
Case "DLD"
acle.CanDeleteDocuments = True
Case "RPD"
acle.IsPublicReader = True
Case "WPD"
acle.IsPublicWriter = True
Case "CD"
acle.CanReplicateOrCopyDocuments = True
End Select
End Forall

REM save all the changes to the database ACL
Call acl.save()

REM Redirect user's browser
wpath = doc.getitemvalue("dbpath")(0)
Print "["+wpath+"ACL?Open&name="+nUser+"]"
End Sub


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  6  ·  Next »
Other articles you might like
Home > Lotus Technologies > Domino (77 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   Sloppy analysis at the core of another Domino vs. SharePoint report
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Remember Young Admins...there are 2 files
WebSphere Portal 6.1.0.2 and Lotus Domino 8.5
The CKEditor - with Domino
How not to crash in LotusScript
IBM Lotus to Google Apps Migration Remorse
Webcast Series: Mobile Collaboration with Lotus Software
Domino Login Control for Mobile Apps
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Struggling with exporting Notes data to spreadsheets? No More!
Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino

  • Don't spend unproductive time maintaining different versions of the same spreadsheet
  • Preserve data integrity and security in multi-user environments
  • Create reports in minutes INSIDE Notes
  • Get freedom from iterative report requests, deliver self-serve capabilities

Experience Reporting, Dashboards, and Analysis INSIDE Notes.

Try IntelliPRINT NOW!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login