As a follow-up to my previous tool that let you analyze the ACL of a database, I built another tool for my admin. For different reasons, we need to keep the mailbox of terminated users, sometimes for a shorter time but sometimes for long periods of time. As far as I understand it, if a traditional approach was used to remove a user from the system, the mail file would also be deleted. So the admin put the terminated user in the Deny Access group and change the ACL of the mailfile to include a manager, supervisor or replacement.
But because of this process, AdminP will not remove the terminated user from all the groups he/she is listed in. When you have hundreds of groups, many of them nested, this could be a real headache. So I was asked to build something simple that allows us to remove one or more specified users from all groups in the Domino Directory. Below is the result. Enjoy!
First you create a form with 3 fields:
'SaveOptions' has a default value of "0" (to prevent the form from being saved).
'Users' is a Names field, getting it's values using the addresses dialog. The field is multi-value and using New Line as separator.
'LogResult' is a multi-value text field, again with New Line as separator.
Finally I add a button to the action bar to remove the user(s). The Lotusscript code is listed below. It is using my class for mail notifications that I blogged about last year to send a confirmation to the user running the agent. This is useful for example when you need to log all data changes done to a system.
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim session As New NotesSession
Dim nab As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim members As Variant
Dim newmembers List As String
Dim delmembers List As String
Dim users As Variant
Dim userlist List As String
Dim user As NotesName
Dim nmcnt As Integer
Dim newarray() As String
Dim ret As Integer
Dim removelog List As String
Dim userarr As Variant
Dim mail As NotesMail
Dim mailtext As String
Dim updated As Boolean
' *** Make sure the operator is sure
ret = Msgbox("Are you sure?",4+32+256,"WARNING")
If ret = 7 Then
' *** Get a list of users in field 'Users'
Set uidoc = ws.CurrentDocument
users = Split(uidoc.FieldGetText("Users"),Chr$(13))
Forall u In users
Set user = New NotesName(u)
userlist(Fulltrim(user.Common)) = Fulltrim(user.Common)
' *** Get all groups in NAB and process them one by one
Set nab = New NotesDatabase(session.CurrentDatabase.Server,"names.nsf")
Set view = nab.GetView("Groups")
Set doc = view.GetFirstDocument
Do While Not doc Is Nothing
Print "Processing " & doc.GetItemValue("Listname")(0)
updated = False
' *** Get members in the group and create a list of the ones to keep
members = doc.GetItemValue("Members")
nmcnt = 0
Forall m In members
Set user = New NotesName(m)
If Iselement(userlist(Fulltrim(user.Common))) = False Then
' User is not among the ones to delete
newmembers(Fulltrim(user.Common)) = Fulltrim(m)
nmcnt = nmcnt + 1
delmembers(Fulltrim(user.Common)) = Fulltrim(m)
updated = True
' *** Build array of members to keep
Redim newarray(nmcnt) As String
nmcnt = 0
Forall nm In newmembers
newarray(nmcnt) = nm
nmcnt = nmcnt + 1
' *** Write array of new members back to document and save it
If updated = True Then
Call doc.ReplaceItemValue("Members", Fulltrim(newarray))
Print "Updating " & doc.GetItemValue("Listname")(0)
Forall dm In delmembers
removelog(doc.GetItemValue("Listname")(0)) = removelog(doc.GetItemValue("Listname")(0)) & dm & ";"
Set doc = view.GetNextDocument(doc)
' *** We are all done
mailtext = ""
Forall rl In removelog
Call uidoc.FieldAppendText("LogResult", "Group '" & Listtag(rl) & "':" & Chr$(10))
mailtext = mailtext & "Group '" & Listtag(rl) & "':" & Chr$(10)
userarr = Split(Cstr(rl),";")
Forall u In userarr
Set user = New NotesName(u)
Call uidoc.FieldAppendText("LogResult", user.Common & Chr$(10))
mailtext = mailtext & user.Common & Chr$(10)
' Call uidoc.FieldAppendText("LogResult", Chr$(10))
Set mail = New NotesMail()
mail.MailTo = session.CommonUserName
mail.Subject = "[Notification] - Users removed from NAB"
mail.Principal = "IT Programs"
Msgbox "Done removing specified user(s) from Domino Directory.",64,"Finished"
I am now an IBM Champion!
Thu, Dec 5th 2013 8:32a Karl-Henry Martinsson This morning I received an email that I have been selected as one of 87 IBM Champions from 18 countries around the world. This is the first time I am awarded this honor, and I am humbled to be listed together with some of the greatest names in the ICS/Lotus community (a.k.a. the Yellowsphere).
So what is an IBM Champion? This is how Oliver Heinz (who takes over after Joy Davis as Community Manager) describes it:
These individuals are non-IBMers who evangelize IBM solutions, share their knowledg [read] Keywords: collaboration
Code – Mask text to remove PII
Mon, Dec 2nd 2013 10:10a Karl-Henry Martinsson Sometimes you need to remove personal identifiable information (PII) from the data you present in an application or on a web page. In the last couple of weeks this issue popped up twice, including one application which needs to be be HIPAA compliant. One solution is to mask any personal identifiable data so that the recipient can still verify the information, without sending it all in clear. I am sure you all seen this on for example credit card statements, with only the last 4 digits of your cr [read] Keywords: domino
“Half an operating system: The triumph and tragedy of OS/2″
Tue, Nov 26th 2013 12:47p Karl-Henry Martinsson The other day I found an interesting article at arstechnica about the history of OS/2, the IBM operating system that was supposed to replace MS-DOS. “Half an operating system: The triumph and tragedy of OS/2” brings back a lot of memories for me.
I worked at Microsoft in 1988/89, when the first couple of versions of OS/2 had just arrived on the market. IBM was just down the road, and one day my boss gave me a stack of floppy disks containing the Microsoft-developed OS/2 version 1.1 [read] Keywords: ibm
Book Review: A man called Ove
Mon, Nov 11th 2013 10:20a Karl-Henry Martinsson One of the most talked about books in Sweden in 2012 was “En man som heter Ove” (“A man called Ove”) by Fredrik Backman. Fredrik did the unusual thing to debut with two books at the same time, his other book was called “Saker min son behöver veta om världen” (“Things My Son Needs To Know About Life”). Earlier this month his third book, “Min mormor hälsar och säger förlåt” (no english title yet, translates to roughly “ [read] Keywords:
API for ZIP Code Distance, Radius, and more
Wed, Oct 16th 2013 5:15p Karl-Henry Martinsson The other day I stumbled on a really cool website, where they offer a free API to calculate distance between two US ZIP codes, all ZIP codes in a specific radius from a given ZIP code, as well as a few other ZIP code related functions.
The results can be returned in different formats, like JSON, XML and (in some cases) CSV. Highly recommended! The URL is http://zipcodedistanceapi.redline13.com/
I am considering creating a Lotusscript class for some of the [read] Keywords: lotusscript
Excellent Bootstrap select plugin with great support
Wed, Oct 16th 2013 5:03p Karl-Henry Martinsson For a project I am currently working on, I needed a nicer looking select box (drop down) than what Bootstrap offers out of the box. I did some searches and found a handful of free ones, most of them pretty good but not exactly what I wanted. Some did not handle different themes, other had additional functionality I did not want/need, etc. I probably been looking for a good alternative for 3 weeks by now.
Then the other day I found an inexpensive plugin at CodeCanyon. Custom Select for Twitter [read] Keywords: bug
Bose takes on Sonos
Thu, Oct 10th 2013 11:44p Karl-Henry Martinsson Bose, well known for their noise-cancelling headsets and bluetooth/iPhone speakers in the SoundLink/SoundDock series, today presented a new series of multi-room audio products, which they intend to compete with Sonos Multi-Room Music System.
Today three products were released in time for the holiday season, with more products in the works for next year. I was able to play around with them for a little while, and I have to admit, they sound really good.
SoundTouch 30, Soundtouch 20 and Soun [read] Keywords: iphone
Time to nominate IBM Champions
Tue, Oct 8th 2013 10:02a Karl-Henry Martinsson Kathy Brown recently posted about the nomination of IBM Champions for 2014, and I wanted to spread the word as well.
Anyone can nominate non-IBMers who are sharing their knowledge, evangelize and advocate for IBM Collaboration Solutions (ICS), help grow and nurture the community and provide feedback to IBM (both negative and positive) in a professional manner.
You can learn more at the IBM Champion website, and (more important) you can also nominate someone you feel should be an IBM Champion. [read] Keywords: collaboration
Thu, Oct 3rd 2013 9:42a Karl-Henry Martinsson Today I logged in to IdeaJam (#thanksbruce) and for some reason I decided to look at my own old ideas, something I haven’t done in a while. I noticed this post, from december 2010, almost a year before IBM launced the XWork server in October 2011…
Perhaps IBM listens sometimes, even if they did not make it free, $1000/year is not a bad price for a powerful server like Domino/XWorks. [read] Keywords: domino