Automatically adding people in ACL & setting UserRoles

Hi there,

I was wondering if there is a way to add a person to the ACL and assign a userrole automatically by the input of a form. So basically if the form has a field to enter the persons name, the form would be saved but would also add the person to the ACL and assign a userrole called “[Management]” … Any assistance would be greatly appreciated. :slight_smile:

Thanks.

Subject: Automatically adding people in ACL & setting UserRoles

use script to add users and assign roles. See AddRole method in the NotesACL class.

Subject: RE: Automatically adding people in ACL & setting UserRoles

Hi Stan,

Thanks, I was just reading on it after I made this post. :slight_smile:

Subject: RE: Automatically adding people in ACL & setting UserRoles

Hi Stan,

When testing this out, Can this work if database is on local?

Subject: RE: Automatically adding people in ACL & setting UserRoles

i’ve found user roles to not work properly on local. Atleast show hide according to a certain userrole does’nt seem to work on local. Addrole in the ACL class just adds a role to the list. Have you found out how to add a user automatically with assigned role(s) to the ACL through a form? I’d be interested. Thanks.

Subject: RE: Automatically adding people in ACL & setting UserRoles

Hi,

We I found a piece of script from lotus help, I havent tested it out, but here is an example.

This script prompts the user for the name of a person. The script creates a new entry for the person in the ACL of the current database, and gives the entry Author access. The script then asks the user to confirm the ACL change. If the user selects Yes, the change is saved. If the user selects No, the change is not saved.

In order to use the constants associated with the Messagebox function, this script must include the file LSCONST.LSS.

Dim session As New NotesSession

Dim db As NotesDatabase

Dim acl As NotesACL

Dim entry As NotesACLEntry

Dim newName As String

Dim confirm As Integer

Set db = session.CurrentDatabase

Set acl = db.ACL

newName = Inputbox$ _

( “Who do you want to add?”, “Name” )

Set entry = New NotesACLEntry _

( acl, newName, ACLLEVEL_AUTHOR )

confirm = Messagebox _

( “Are you sure?”, MB_YESNO, “Confirm” )

If ( confirm = IDYES ) Then

Call acl.Save

End If

Subject: RE: Automatically adding people in ACL & setting UserRoles

From your initial post, you mentioned that you also wanted to assign a role to the users you added to the ACL. The code you just posted won’t do that. And as Andrew mentioned, I don’t know of any way, through standard LS anyway, for you to be able to associate a role with an ACL entry.

I’m just wondering, is there any reason why you just don’t create a group in the address book, add that group to the ACL and associate the [Management] role to it? Then certain people can be given the right to update the members of that group in the address book.

From an operational and management standpoint, this method would seem much easier and preferable than building a mechanism to add individuals to the ACL. And I guess you would also need to build a process to remove individuals from the ACL? And then there’s the issue of needing Manager level access to update the ACL . . .

. . . . just a thought