Edit document if role is enabled

Querymodechange event script should check for selected category in the form set value based on selection and save the document. when different user try to edit the script should check for role from acl if current user role match and enabled then allow to edit otherwise do not allow to edit. My script allow user to edit for any role settings. It’s not checking and comparing against the AcL Please advise what I can do.Dim WorkSpace As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim userName As New NotesName(session.UserName)

Dim userole As String, userole1 As String

user = userName.Abbreviated

Set db = session.CurrentDatabase

Set acl = db.ACL

Dim entry As NotesACLEntry

Set entry = acl.GetEntry(userName.Abbreviated )

Messagebox acl

userole = source.FieldGetText(“GetRole”)

Forall r In entry.Roles

If source.editmode=False Then

If userole=“1” Then

Continue=True

End If

Else

'Dim boxType As Long, answer As Integer

'boxType& = MB_OK + MB_ICONSTOP

answer% = Messagebox(" You are not authorized to edit this form.", boxType&, _

“Edit Form”)

continue=False

End If

End Forall

Subject: Use database ACL, Authors fields to control edit access

Querymodechange code is not secure; if a user technically has access to edit a document, they can easily bypass this.

As for why your code doesn’t work, you have a simple logic error. This is not something you need an expert to solve. Just think about what each statement is doing.