I want to edit a documnet basic on userrole, and write the follow code, I don’t know why “Roles” always return “0”. Can anybody help me?
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Roles = Evaluate(|@IsMember(“[Editor]”; @UserRoles)|)
If Roles(0) =1 Then
Continue = True
Else
Continue = False
End If
Subject: Edit document basic on role
Notes has perfectly good built-in document-level security. Why are you coding your own? Simply give the users Author access and use an Authors-type field with “[Editors]” as the value.
That being said, Evaluate returns a Variant array (the same as a field does).
Subject: RE: Edit document basic on role
I just want when the document is closed, nobody can edit, except some…
Subject: RE: Edit document basic on role
And that’s what Author access and Authors-type fields are for. Form events are not security – any user who has ACL permission to edit documents can change any value with an agent, and they will do that if they can and you haven’t properly secured the document. If the user has Author access to the database and is not listed in an Authors field, they cannot make any changes to the document by any means. (You can still allow them to carry out actions by using a run-on-server agent when necessary.)
Subject: Edit document basic on role
Your code is valid - I just tested it.
Try putting var = Evaluate(|@UserRoles|)
in your code and stepping through it with the debugger.
If you are testing on a local database, you need Enforce Consistent ACL ticked on the Advanced tab of the ACL.
Subject: RE: Edit document basic on role
Yes, It works. I test on local. thank you very mucy
Subject: RE: Edit document basic on role
It may be working, but try this:
-
Make sure you don’t have the role in the ACL.
-
Select a document in the view.
-
Hit CTRL+E.
Please do yourself, your users and your application a big favour and use an Authors field instead of trying to code your own security.