Give roles to the users from a form

Hi everybody,

I would like to give roles to the users that I have in ACL from a form.

I have a form with the name of a user, adress, etc… (which one are in ACL) and what I need is to give the rol that I want and change it after if it is necessary from the same form.

Please I hope you answer

I have this script but i need the name of the persona was in a variariant.

Sub Click(Source As Button)

Dim s As New notessession

Dim db As notesdatabase

Dim acl As notesacl

Dim entryacl As notesaclentry

Set db = s.currentdatabase

Set acl = db.acl

Dim docperson As String

Set aclentry = acl.getentry("John")

If Not aclentry Is Nothing Then

	aclentry.enablerole("Jefe de equipo")

	Call acl.save()

End If

Please I hope you answer

Subject: RE: give roles to the users from a form

It’s not clear to me what’s stopping you from doing what you want to do.

Are you asking how to read a value from a field on the form?

Subject: RE: give roles to the users from a form

No, what i need is to can give a role value to an user since a form. By ex:

i have a form with two fields : username and rolename and access_level i want that when i save the document the username, access level and rolename goes directly to the ACL.

Thanks an advance.

Subject: RE: give roles to the users from a form

I think you need to ask your question more precisely. What prevents you from doing what you want?

Do you want to update the ACL instead of saving the document, or in addition to saving the document?

Is the person editing the document always a manager of the database? (i.e. do they have access themselves to update the ACL?)

Must the ACL update happen immediately, or will a few minutes later be soon enough? What about an hour later?

Why are you doing this instead of just using File / Database / Access Control in the Notes client?

Will you have only individual usernames in the database ACL, or will you use some groups? If you have many users with roles, it’s generally better to use a group document in the Domino directory, and put the group name in the ACL. If you do that, you should not necessarily expect to find the user’s name in the ACL. You might need to edit the membership of a group instead of making a change to the ACL. You can do that with LotusScript, but the code is more complicated.

If you don’t find the username in the ACL, do you want to add it?

All of these questions are important in finding the best answer to your question.

Sub Postsave(Source As NotesUIDocument)

Dim doc As NotesDocument

Dim session As New NotesSession

Dim db As NotesDatabase

Dim acl As notesacl

Dim strName As String, strLevel As String

Dim entryacl As notesaclentry

Set doc = Source.Document

strName = doc.GetItemValue(“fieldname”)(0)

strLevel = doc.GetItemValue(“anotherfieldname”)(0)

Subject: RE: give roles to the users from a form

1.- A person will have to update the acl without have manager permissions.

2.- I want to update the ACLin addition to saving the document…

3.- No, the person only will have permission of authors

4.- The acl must update inmediately

5.- Only individual usernames. I only will have five or six users.

6.- The user will be correct because i get it of the domino directory…

Thanks a lot for your help

Subject: RE: give roles to the users from a form

Just because the user runs LotusScript code, does not let them do things that they do not have access to do.

To do what you’re asking, you will need to write a server agent. Use NotesAgent.RunOnServer to call the agent from the Postsave event of the form, and pass it the note id of the document that was just saved. If the agent is signed by someone with Manager access, it will be able to update the ACL.

Please refer to Examples: RunOnServer method in the Designer help to see how this is done.