Prevent user from editing document

I put following script in the “Querymodechange” event for avoiding that a document can still be edited when the status = “5. PO issued”.

Dim ws As New notesuiworkspace

Dim uidoc As notesuidocument

Dim doc As Notesdocument

Set uidoc=ws.currentdocument

Set doc=uidoc.document



If doc.Status(0)="5. PO Issued"   Then

	Messagebox "This PO has been approved. It cannot be further edited."

	Continue=False

End If

This works fine, however when a user opens a document with the ctrl + E , then he can get round the prohibition. How can I avoid this?

Subject: prevent user from editing document

By using Author-level access and Authors fields to control who can edit documents under which conditions.

Subject: RE: prevent user from editing document

Stan,

EVERYBODY should be able to create a document and edit it until the status has reached “5. PO issued”. At that time NOBODY should be allowed anymore to edit a document.

I assume it’s hard to perform this with Authors fields…?

Subject: RE: prevent user from editing document

Not at all. “*” is everybody, “” is nobody.

Subject: prevent user from editing document

Have computed fields showing when this status is set, and hide the editable fields, when (@left(Status;1)=“5”

Sorry, absolute hack, but it would work…

Subject: RE: prevent user from editing document

There really is no need to use ‘hacky’ solutions. Stan’s suggestion of using the Author fields makes perfect sense… it is afterall what they were designed for!

Give all users Author level access, have the field set to an ACL role and give the users that role in the ACL.

When the status changes to “5. PO issued” simply set the Author field to be another role that the users have not been assigned in the ACL.

Subject: RE: prevent user from editing document

Couldn’t agree more. A hack is the wrong way to go and provides false security. The savy use could write an agent to change the field and bypass the hack. Even if you disabled creation of agents, a user could write a Visual Basic, Java or just about anything else to change the document.

As a side note, I have always thought it a serious sercurity flaw to not have some way of limiting COM, Java and ODBC access by user. There may be times I want the user to change data with a Notes form but from no other source.

Subject: prevent user from editing document

Put the same code in the QueryOpen event but put it inside an If statement

If source.editmode=true then

End if

Mike

Subject: RE: prevent user from editing document

Mike,

It still allows to edit the document…

Morever it’s giving an error “object variable not set” at

Set doc=uidoc.document