Solved

Need help with edit rights, get an error

Posted on 2003-11-29
18
582 Views
Last Modified: 2013-12-18
Hi guys

I seem to be having edit rights problems

I have two forms

When the first form status is Approved or Cancelled a script runs which updates the second form.

There is an error message
You cannot update or delete the document since you are not listed as an allowable Author for this document


The Edit_Rights field on the second form is Authors, Computed, Allow Multiple Values

Formula is @Trim("[Admin]":cur_Manager:cur_SiteManager)

When I look at the Edit_rights field thru the properties box the sorrect names are showing.



0
Comment
Question by:adspmo
  • 8
  • 4
  • 3
  • +1
18 Comments
 

Author Comment

by:adspmo
Comment Utility
The edit rights field has the same properties as the second form

One := @If(ApprovalStatus = "Draft" ; RequesterName ;"");
Two :=@If(Status_Flag = "2"& ApprovalStatus ="Processing";Approver_1 ; "");
Three :=@If(Status_Flag = "3"& ApprovalStatus ="Processing";Approver_2 ;"");
No := "NoAccess";
Rejected := @If(Status_Flag = "1" & ApprovalStatus = "Rejected"; RequesterName;"");
Rights := @Unique (@Trim ( "[Coordinator]" : One:Two:Three:Rejected:No));
@Trim(Rights)

I am wondering if this could be because the formula that sets the ApprovalStatus sets the status to Approved and the Staus Flag field is set to "4"
Maybe I should set this is the Approval Script after the other forms have been updated

What do you think

James
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Depending on notes/web client and user triggered/scheduled, it could be the user that updates those doc's or the signer of the agent. Find out who is actually updating those doc's by printing the username, or by showing it in a @prompt([OK]; ..)-box or messagebox.

Another cause could be the the format in which cur_Manager and cur_SiteManager store usernames. Don't use common names, but include all OU's etc.
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Your 2nd post wasn't there just a few minutes ago. Still, it could depend on the format of RequesterName, Approver_1 and Approver_2.

Your concern about Status_Flag="4" etc., could be valid if you manage to write the new authors value to the documents: it would only leave "[Coordinator]" if you set the authors field to Rights.
The current problem is caused by what's already stored in the author field; not in its inteded new value!

Confusing... you've now given two different author formulas for the 2nd form....!
0
 

Author Comment

by:adspmo
Comment Utility
THe 2nd formula is the edit rights for the first form

James
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
Hi adspmo,

Please copy the full text of the properties box (click and drag from "Field name" and drag past the bottom until Notes will not scroll any further; make sure to get the last few chacareters; then press CONTROL-C to copy).

Please also post the update script.

Best regards,
qwaletee
0
 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
It is your first form I believe which is raising the error. As a quick test include Username at the end of the formula

like

@Trim(Rights : @UserName), this should bypass that error.

In that case include another display author field which will include the @UserName as the author until the current doc is saved and afterwards the user loses rights..if that was your original intention.

~Hemanth
0
 

Author Comment

by:adspmo
Comment Utility
Hi

I tried the UserName Thing and It worked, However it holds the UserName and won't refresh when the new user opens the doc

Also should this pick up the Username when in read or does it have to be in edit to pick up the new mame. Either way it is not

The new field is called

CurrentAuthor  Author Computed for Display

James
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
You'll need to edit it in order to change it. Is there a way to gain access through those userroles temporarily, to set things right?
0
 

Author Comment

by:adspmo
Comment Utility
It fails with the UserROles, CurrentAuthor etc..


It fails in the Savit
SaveIT:
      doc.ComputeWithForm True, False  
      doc.save True, False  Here is where it fails

I am beginning to think it is the 2nd form that is causing the grief

It has as edit_rightd field as well

Here is the properties from the first form
Field Name: Edit_Rights
Data Type: Text List
Data Length: 66 bytes
Seq Num: 2
Dup Item ID: 0
Field Flags: SUMMARY READ/WRITE-ACCESS NAMES

"[Coordinator]"
"Approver Two"
"NoAccess"
"CN=James Wood/O=TestPMO"

Second form

Field Name: edit_rights
Data Type: Text List
Data Length: 39 bytes
Seq Num: 2
Dup Item ID: 0
Field Flags: SUMMARY READ/WRITE-ACCESS NAMES

"[Admin]"
"Site Manager"
"Approver Two"


I am using the Approver Two id

Will the first form pick the field CurrentAuthor if it is set to  Computed for Display and what would be the best way to set it to Null when the current user exits the document??

James
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:adspmo
Comment Utility
I forgot I am at home so this is a local copy Userroles won't work

Have to wait till tomorrow to test that

Still I want to verify my edit right setup

I would be interested in any other way of acheiving succes with this as well
0
 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
First the local copy can be enforced for acl restrictions by enabling enforce consistent acl across all replicas inthe advanced section of acl dialog settings.

If you are successful with Username.. then why should the new user opening the doc should lose access.. anyone other has role like "[Coordinator]" or "Approver Two" or "NoAccess"  (I believe last two are groups) can always access the document. Can you explain how this access restrictions should work in detail ?
0
 

Author Comment

by:adspmo
Comment Utility
One := @If(ApprovalStatus = "Draft" ; NameFull;""); Pretty Obvious

Two :=@If(Status_Flag = "2"& ApprovalStatus ="Processing";Approver_1 ; "");Should only be Approver_1(fieldname)

Three :=@If(Status_Flag = "3"& ApprovalStatus ="Processing";Approver_2 ;"");Should only be Approver_2(fieldname)


No := "NoAccess";Is nobody,a fake name,Keeps people out

Rejected := @If(Status_Flag = "1" & ApprovalStatus = "Rejected"; RequesterName;"");Obvious

Rights := @Unique (@Trim ( "[Coordinator]" : One:Two:Three:Rejected:No));

So it One when...Two When.... Etc...

@Trim(Rights)I did add user name but what happened was I create with one id ,and submit to to be approved, when the person listed in the Approver_2 field approves,get Notes Error

You cannot update or delete the document since you are not listed as an allowable Author for this document

This happens on the

doc.save True, False


James
0
 

Author Comment

by:adspmo
Comment Utility
Here is the script that runs. There is a formula as well in the Approved button if you need to see it let me knnow

Sub Approved
      'Set the session and db variables
      Dim ws As New NotesUIWorkspace
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim doc As NotesDocument, note As notesdocument
      Dim view As NotesView
      Set note = ws.CurrentDocument.Document
      Set db = session.CurrentDatabase
      Set view = db.GetView( "AvailHol")
      If view Is Nothing Then
            Msgbox "Cannot find view"
            Exit Sub
      End If
      If note.HasItem("NameFull") Then
            Set doc = view.GetDocumentByKey(note.RequesterName(0)) ' KEY Value passed to view
      Else
            Msgbox "No leave document found for this employee"
      End If
      
      If Not doc Is Nothing Then
      'The conditions for processing the vacation vary greatly thus the variety of variables
      'There is a field named carry over and it may contain Carried over vacation days. These need to be used first
      'then the alloted vacation. If the Carry Over are not used by July then they are forfeited
            
            If note.type(0) = "Vacation" And  Month(note.StartDate(0)) >6 Then '
                  tmpNewDaysTotal = note.NewDaysTotal(0)    'Number of actual vacation days
                  tmpAllowanceAH_1 = tmpNewDaysTotal + doc.AllowanceAH_1(0) 'calculate the number of used vacation days
                  tmpAllowanceAH_2 = doc.allowanceAH_2(0) - tmpNewDaysTotal ' calculate the remaining vacation days
                  doc.AllowanceAH_1 = tmpAllowanceAH_1
                  doc.AllowanceAH_2 = tmpAllowanceAH_2
                  doc.totalAH_1 = doc.CarriedOverAH_1(0) + doc.AllowanceAH_1(0) 'Calculate the used vacation  days
                  doc.totalAH_2 = doc.CarriedOverAH_2(0) + doc.AllowanceAH_2(0)'Calculate the remaining vacation days
                  Goto SaveIt
                  
            Else
                  If Month(note.StartDate(0)) < 6 And note.type(0) = "Vacation" Then
                        If note.newdaystotal(0)  =< doc.CarriedOverAH_2(0) Then 'Check the carryover remaing days first
                              doc.CarriedOverAH_1 = doc.CarriedOverAH_1(0) + note.NewDaysTotal(0) 'Calculate the used carryover  days
                              doc.CarriedOverAH_2 = doc.CarriedOverAH(0) - note.NewDaysTotal(0) 'Calculate the remaining carryover days  days
                              doc.totalAH_1 = doc.CarriedOverAH_1(0) + doc.AllowanceAH_1(0)'Calculate the used vacation  days
                              doc.totalAH_2 = doc.CarriedOverAH_2(0) + doc.AllowanceAH_2(0)'Calculate the remaining vacation days
                              Goto SaveIt
                              
                        Else
                              If (doc.CarriedOverAH_2(0) <> 0)  And (note.newdaystotal(0)  > doc.CarriedOverAH_2(0)) Then
                                    tmpCarriedOverAH_2 = doc.CarriedOverAH_2(0) 'Get the current value
                                    tmpNewDay = note.newdaystotal(0) - tmpCarriedOverAH_2  'Calculate the difference between the requested and the carryover
                                    tmpAllowanceAH_2 = doc.AllowanceAH_2(0) - tmpNewDay ' calculate the remaining vacation days
                                    tmpAllowanceAH_1 = doc.AllowanceAH_1(0) + tmpNewDay  'calculate the number of used vacation days
                                    doc.CarriedOverAH_1 = doc.CarriedOverAH_1(0) + tmpCarriedOverAH_2 'Calculate the used carryover  days
                                    doc.CarriedOverAH_2 = 0 'Set the available to 0
                                    doc.AllowanceAH_1 = tmpAllowanceAH_1 'Set the values
                                    doc.AllowanceAH_2 = tmpAllowanceAH_2 'Set the values
                                    doc.totalAH_1 = doc.CarriedOverAH_1(0) + doc.AllowanceAH_1(0) 'Calculate the used vacation  days
                                    doc.totalAH_2 = doc.CarriedOverAH_2(0) + doc.AllowanceAH_2(0) 'Calculate the remaining vacation days
                                    Goto SaveIt
                              Else
                                    If doc.CarriedOverAH_2(0) = 0 Then
                                          tmpNewDaysTotal = note.NewDaysTotal(0)    'Requested days vacation
                                          tmpAllowanceAH_1 = tmpNewDaysTotal + doc.AllowanceAH_1(0) 'calculate the number of used vacation days
                                          tmpAllowanceAH_2 = doc.allowanceAH_2(0) - tmpNewDaysTotal ' calculate the remaining vacation days
                                          doc.AllowanceAH_1 = tmpAllowanceAH_1  'Set the values
                                          doc.AllowanceAH_2 = tmpAllowanceAH_2   'Set the values
                                          doc.totalAH_1 = doc.CarriedOverAH_1(0) + doc.AllowanceAH_1(0)  'Calculate the used vacation  days
                                          doc.totalAH_2 = doc.CarriedOverAH_2(0) + doc.AllowanceAH_2(0)   'Calculate the remaining vacation days
                                          Goto SaveIt
                                    End If
                              End If
                        End If
                  End If
            End If
            
            If note.type(0) = "Personal" Then
                  tmpPersonalDaysAH_2 =doc.PersonalDaysAH_2(0) - note.NewDaysTotal(0) 'Calculate the remaining personaldays
                  tmpPersonalDaysAH_1 = note.NewDaysTotal(0) + doc.PersonalDaysAH_1(0)'Calculate the used days
                  doc.PersonalDaysAH_2 = tmpPersonalDaysAH_2  'Set the values
                  doc.PersonalDaysAH_1 = tmpPersonalDaysAH_1   'Set the values
                  Goto SaveIt
                  
                  
                  If note.type(0) = "Work From Home" Then
                  End If
                  
SaveIT:
                  doc.ComputeWithForm True, False  
                  doc.save True, False
            End If      
      End If
End Sub
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
I assume Approver Two is an actual Notes ID, and has a hierarchical name, e.g., CN=Approver Two/O=TestPMO, correct? You shoudl have the full canonical, hierarchical name listed, not just the common name part of the ID.
0
 

Author Comment

by:adspmo
Comment Utility
So should I use just @username then
0
 
LVL 24

Assisted Solution

by:HemanthaKumar
HemanthaKumar earned 250 total points
Comment Utility
yes that should do
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 250 total points
Comment Utility
adspmo,
> So should I use just @username then
In author field calculations?  Yes.  Not @Name(...; @UserName), just plain @UserName.
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
'Told ya so.... don't use common names!
;-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now