Tip

Restricting Database Access After Hours

This is a quick way to restrict access to a Notes database for those customers
who do not fully understand Notes security and want the database "shut down"
after hours. (My customer physically wanted the server to be shut down on a
nightly basis)

I created a scheduled agent that runs at 8:00 pm nightly to modify all entries
in the ACL except Managers and set their access to No Access. This restricts
all users while allowing you to still administer the server after hours. I
also wrote another scheduled agent to grant access that runs at 8:00 am.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
Dim acl_entry As NotesACLEntry

On Error Goto ProcessError

Set nlog = New NotesLog("Restrict Access")
Call nlog.OpenAgentLog()
Call nlog.LogAction("Agent Started")

Set db = session.CurrentDatabase

If (db Is Nothing) Then
Call nlog.LogAction("db is nothing")
Exit Sub
End If

Set acl = db.ACL
Set acl_entry = acl.GetFirstEntry()

'ACL Level Access Key
'ACLLEVEL_NOACCESS = 0
'ACLLEVEL_DEPOSITOR = 1
'ACLLEVEL_READER = 2
'ACLLEVEL_AUTHOR = 3
'ACLLEVEL_EDITOR = 4
'ACLLEVEL_DESIGNER = 5
'ACLLEVEL_MANAGER = 6


While Not (acl_entry Is Nothing)
Select Case (acl_entry.Level)
Case ACLEVEL_DEPOSITOR:
Case ACLLEVEL_READER:
Case ACLLEVEL_AUTHOR :
Case ACLLEVEL_EDITOR :
Case ACLLEVEL_DESIGNER:
acl_entry.Level = ACL_NOACCESS
End Select
Set acl_entry = acl.GetNextEntry(acl_entry)
Wend

'save changes to the ACL
Call acl.Save
Call nlog.LogAction("agent completed successfully")
Call nlog.Close

Exit Sub

ProcessError:
Call nlog.LogError(Err,Error$ & " occured at line " & Erl)
Exit Sub

End Sub

This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.