Search

Ads by Google

MiscLinks

« Domino Document Locking Class 1.1 | Main| Domino Environment Part II: Library Templates »

Domino Document Locking Class 1.3

Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

Here is an update to the Document Locking Class 1.1 and Document Locking Class , this update allows the unlocking overriding for Manager access (coded by Michael Sobczak) or overriding by group or role.
Public Sub new ( inDoc As Variant )
Public Sub SetCurrentUser ( user As String )
Public Function hasDocument ()
Public Sub setDocument ( inDoc As NotesDocument )
Public Sub setUIDocument ( inUIDoc As NotesUIDocument )
Public Property Get CurrentUser As String
Public Property Get toString As String
Public Property Get ShowPrompts As Boolean
Public Property Set ShowPrompts As Boolean
Public Function LockingEnabled () As Boolean
Public Function IsLockedByCurrentUser () As Boolean
Public Function IsDocumentLockedByCurrentUser (doc As NotesDocument ) As Boolean
Public Function IsUIDocumentLockedByCurrentUser ( uiDoc As NotesUIDocument ) As Boolean
Public Function LockedBy ( ) As String
Public Function IsLocked ( ) As Boolean
Public Function IsDocumentLocked ( doc As NotesDocument ) As Boolean
Public Function IsUIDocumentLocked ( uiDoc As NotesUIDocument ) As Boolean
Public Function Lock ( ) As Boolean
Public Function LockUIDocument (uiDoc As NotesUIDocument ) As Boolean
Public Function LockDocument ( doc As NotesDocument ) As Boolean
Public Function UnLock ( ) As Boolean
Public Function UnLockUIDocument ( uiDoc As NotesUIDocument ) As Boolean
Public Function UnLockDocument ( doc As NotesDocument ) As Boolean
Public Sub RoleGroupOverRide ( RoleGroup As String )


Domino Document Locking

Select All


Comments

1 - Hi Chad,
just want to emphasize the requirement for overiding the manager access:
Unlocking without manager rights does only work if you are explicitly listed in an author item of the document - by Name, Role or Groupmembership.
Editor or designer access does not suffice.
Otherwise you recieve an error that the document is already locked by another user. :-

Thanks for sharing.
VM

2 - Hi Chad

Is that work on the web?

And with a load balancing cluster...

Thanks

3 - I have used it on the web, so yes it will. As for the balancing cluster, it should work because this class is using the Domino Document Locking feature and nothing else, this class is just a wrapper to handle the common errors/situations that are not provided by Domino.

4 - I have used it on the web, so yes it will. As for the balancing cluster, it should work because this class is using the Domino Document Locking feature and nothing else, this class is just a wrapper to handle the common errors/situations that are not provided by Domino.

5 - Hi Chad, great work the Domino Document Locking Class, but I've got a problem unlocking a doc using that code from a web agent. The problem is in line

pUser = Session.UserName

because Session.UsersName returns the server name where the agent is executed rather than the user name, so when you check if user can unlock a doc the comparison always fails.

I avoid that issue using this code

pUser = Session.EffectiveUserName

I don't check if with this change the code still work on client.

6 -

7 - Thanks Dennis I will take a look at it.

8 - I am new to Domino. Where do I past the document locking logic.

9 - I would place the code into a script library so it can be used by anything.

10 - Chad I need a help,

I paste code 'Domino Document Locking' in script library.
Where and how I can call function from this class.
Thank's Bojana



11 - Bojana, it all depends on what you need done. Is this a UI or backend usage. For the most basic usage you would need to call LockUIDocument and UnLockUIDocument if you where need to lock a UI document.

12 - Hi, Chad
Thanks for your response, i have few question for you.
I don't have experience with custom class.

This is scenario which i would like to have in application for web clients.

USER 1 open document in edit mode, and for other users that document is read only. If they try to put that document in edit mode ... show message
"Document is locked by USER XX" and they have visible button = unlock.

Function of that button is to change mod for USER 1 (from Edit to Read mode) and USER XX change mode for read to edit. Is that possible??

Any help will be appreciated very much. Emoticon

13 - I realize this is not exactly what you are looking for but this was all that I could find. Maybe Michael Sobczak has an example for you.

Use "Domino Document Locking"

Dim session As New NotesSession
Dim doc As NotesDocument
Dim uidoc As NotesDocument
Dim ddl As New DominoDocumentLocking( doc )
Print "True: " + Cstr( True )
Print "No Document: False"
Print ddl.hasDocument()
Print ddl.toString()
Print "Document Context: True"
Call ddl.setDocument( session.DocumentContext )
Print ddl.hasDocument()
Print ddl.toString()
ddl.ShowPrompts = True
Print ddl.LockingEnabled()
Print ddl.toString()
ddl.ShowPrompts = True
Print ddl.LockingEnabled()
Print "Locking 2"
Print ddl.toString()
Print ddl.LockedBy()
ddl.RoleGroupOverRide( "Admin" )
ddl.UnLock
Print ddl.toString()

14 - could you please give me the nsf database example for this script ? . i've ever tried to use this script but it did not work. may be i don't understand your code

15 - Hi, I think your code is great. I was trying to use it for a Notes web application.

Do you have a NSF sample link or maybe a code snippet? It will be very helpfull.

Thanks and great work!

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)