Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Authors field doesn't work 1

Status
Not open for further replies.

IG3Rosen

IS-IT--Management
Jan 5, 2005
40
FR
Hi,

I have a computed author field called "Auteur" with this formula :

@If(@IsMember("[AdminMenu]";@UserRoles);(@Name([Canonicalize];@UserName));"")

In order to give the right to the user to modify the doc if he has the [AdminMenu] role.

.. But it doen't work

- The field "Auteur" contains the full canonicalised name
- I have ceated another field with the @autor formula in order to check where is considered as an Author, an it returns the User Name, and that seems to be right.

I don't know why it doesn't work...
Thanks








 
You are confused about how the author type field works.
The author field must contain the names of the people, groups or roles that can modify. Therefor, you have no need to write a formula to check, since Notes does the check itself.
If users with the role [AdminMenu] are entitled to be author of the document, then you need to put "[AdminMenu]" in the field.
That's all.
Oh, by the way, you might want to read this FAQ (faq73-5664) on Reader and Author fields. It could help you in the long run.

Pascal.
 
Ok yes, I tryed in a new database and it's working !

But I do the same in my database and itsn't working.
I have a lot of old fields (fields i doesn't use in any form but wich are still proposed in the programmers panel although I deleted them ..).
Maybe this is "poluating" my database.. Is there a way to suppress them ?
 
You say that you are using a role to check Author access - are you testing locally on your Notes client, or is the database hosted on a server ?
Because if the db is local, then the Notes client does not check for roles. Actually, when a db is stored outside of a Domino server, the Notes client ignores the ACL entirely - unless you check the option "Enforce consistent ACL across replicas", which is on the Advanced panel in the ACL properties of the database.

My guess is that you are not using a Domino server, and that is why the roles appear to not function.

Pascal.
 
- Yes, I'm testing locally on my Notes client.

- Ok i didn't know that the UserRoles arn't cheked by the NotesClient. But I tested the base with the user names.

What about the "fantômes" fields in my database ?
Are they a possible cause of my problemes ?

 
Testing with users is the same if the Author field has roles in it. The users will not be recognized as having the role, so they will not be author.
You really should have a test server to do your development on. Makes things a lot simpler.

Pascal.
 
I should say in my precedent post :

-.... tested the base with the user names in the author field.

Rosen
 
I found the probleme source:

I didn't say that the document was created with a action view button.
The code :

Code:
Sub Click(Source As Button)
	
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim doc As NotesDocument
	Dim NomSite As String
		
	Set db = session.CurrentDatabase
	
	Set doc = New NotesDocument (db)
	
	NomSite = Inputbox("Nouveau site","Nouveau Site","")
	If NomSite = "" Then
		Exit Sub 
	End If
	
	doc.form="RepasSemaine"
	doc.RepasSemaineSite=(NomSite)
	doc.From=session.Username
	Call doc.Save(0,0)
	
End Sub

Whith this code when i created a document "A" with the user Toto with author acces lotus didn't allow Toto to modifie this document Although Toto was in the author field
( when i looked on the document properties my author field didn't appear as a author fied
=> indicateurs de champ : SUMMARY "CN=Toto/O=Toto" )

but when
- I pass Toto in Editor
- Toto modifi the doc "A"
- I Pass Toto in Author
- Toto is allowed to modifie the doc "A" (marvelous)
..ans the properties of the author field looks like a Ahthor field.
=> READ/WRITE-ACCESS NAMES "CN=Toto/O=Toto"

So i though the way i created the doc an fill the fields wich is'n good..


The Code witch is working

Code:
Sub Click(Source As Button)
	Dim workspace As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Dim NomSite As String
	
' saisie du nom du site	
       NomSite = Inputbox("Nouveau site","Nouveau Site","")
        If NomSite = "" Then
	   Exit Sub 
         End If
'création du document en avant plan	
        Set uidoc = workspace.ComposeDocument	( "", "", "RepasSemaine" )
	Call	uidoc.FieldSetText("RepasSemaineSite", NomSite)
	Call uidoc.GotoField("RepasSemaineChoix")
	Messagebox(NomSite)
	End Sub




However what will i do when I would need to create document without to show it to the user .. ( euu Will i ever have the utilitie od that ?) (hummm escuse me for my english)

Richard
 
Creating a document can very well be done in the backend.
For example, if you want to create a Memo, all you need to do is create a NotesDocument, fill in the necessary fields, and use the ComputeWithForm method before saving it.
That way, the document you save will be just as if a user actually created it in the client.
Of course, the Memo example may not be the best - the mail template must be one of the most complicated designs ever made for Notes. But in your case, you should very well be able to do that.

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top