OpenNTF.org - Add your name to the ACL
    Advanced
   OpenNTF Code Bin
Edit Document Code By Date > Code Document
About This Code
Brief Description:
Add your name to the ACL 
Rating:
Not Rated Yet 
Contributor:
Roche Olivier 
Category:
Lotusscript 
Type:
Security 
Document Release:
Notes Version:
R6.x 
Last Modified:
19 Jan 2004 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
This code can be placed on any button in a seperate db, it then executes an agent which is set to run on the server's ID so that access can be gained to the users mail file without you having to tell the user how to add your name to the ACL manually.
Usage / Example
put this code on a form or page in any of your databases.


The Button code:
==============

Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim agent As NotesAgent
Set db = s.CurrentDatabase
Set agent = db.GetAgent("ACL Agent")
If agent.RunOnServer = 0 Then
Messagebox "Agent ran",, "Success"
Else
Messagebox "Agent did not run",, "Failure"
End If
End Sub

Agent - The agent that needs to be called by the button ( Name the agent "ACL Agent")
===================================================================


Sub Initialize
'Add your server name and domain , and the name of the person's mail file into the db
Dim db As New NotesDatabase( "servername/domain", "mail\personmailfile.nsf" )
Dim acl As NotesACL
Dim entry As NotesACLEntry
Set acl = db.ACL
'add your notes id name in this part to give your id access to the mail file
Set entry = acl.CreateACLEntry _
( "YourName/YourDomain", ACLLEVEL_MANAGER )
Call acl.Save
End Sub

All you need to do now is in the agent properties (security tab), change the agent to run on behalf of the server's name, ( this needs to be the server's name that the mail file of the user resides on) and "set runtime security level" to "3".
If you click the button your name will be added as manager to the persons mail file and you dont have to leave your workstation to go and do it manually.

 Comments
Posted by Dovid Gross on 02/18/2004 09:45:33 PM** Or, just use ACLHelp! ... Re: Add your name to the ACL
*
Posted by Christian Brandlehner on 08/13/2004 08:17:14 AMThere was a line missing from your example
this is the corrected code:
Sub Initialize
'Add your server name and domain , and the name of the person's mail file into the db
Dim db As New NotesDatabase( "servername/domain", "mail\personmailfile.nsf" )
Dim acl As NotesACL
Dim entry As NotesACLEntry
' next line is necessary
call db.open
Set acl = db.ACL
'add your notes id name in this part to give your id access to the mail file
Set entry = acl.CreateACLEntry ( "YourName/YourDomain", ACLLEVEL_MANAGER )
Call acl.Save
End Sub
 Add your comment!