Redirector Database
01/04/2007 09:19:59 PM | Cranford, NJ USA
Today I have to get off my chest this very simple database that was designed and redesigned for many of my clients to redirect notes users to a new database. I has been used to consolidate domains and/or servers. Before the user is redirected to the new server, we can also log the users details, time, client version, names, etc. Then the database is closed then the new database is opened. I also added some fun code to 'spray' the users across many servers. So I randomly move someone to either server 1, 2, or 3. (I will document that random generator later).
Things you can learn from this database:- Cool tricks with buttons.
- Randomly open various files based on an array
- And the thing I find most important is how to close a database when needed

Now why is the closing of a database so important? Well first off, I prefer that everyone knows how to do it. (IE: no more secrets) Secondly, this will allow you to do some work, see if the users has the right credentials and then let them in or close it. Even Managers or Designers won't be able to crack your database. Of course if you actually use the designer client you can remove or comment out the code.... But we are talking about using the Notes client.
So this super secret, this thing that certain companies think is the best kept secret in the world. (They pinched it from some one on notes.net!) You READY? ... Create a page with Call Source.close() in the PostOpen. That is the secret!!!
The exact code I used follows:
So if the user does not have a role of [Admin] and your on the server close this page/database. Something so simple but yet so powerful.
Sub Postopen(Source As Notesuidocument)
Dim w As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.currentdatabase
tmp = Evaluate ( |@IsNotMember("[Admin]";@UserRoles)| )
If tmp(0) And db.server <> "" Then
Call Source.close()
End If
End Sub
Please enjoy this code and example database. Spread the word, Clearframe is here.
- dtb
Permalink | Domino Development | Comments ( Disabled )
