Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Add a Role in Formula

Posted on 2009-12-26
Medium Priority
Last Modified: 2013-12-18

I am tweaking a form that has a field called "CurrentEditor" which provides a list of names that will add the names as editors on the document.  I would like to have a role set for all documents to add a specific group as editors to all documents.  The code below is on an "Edit Button" which will allow all authors of their own documents, to see and edit the document (by way of author field) but I need to add the new field DocumentAuthors in which the role "[EditRights]" has been applied so they can see this button as well -- if they are not the authors of the document. (this app is only for notes client -- so the $RefOptions can be ignored)

!(@LowerCase(@Name([CN]; @UserName)) = @LowerCase(@Name([CN]; From) : @LowerCase(@Name([CN]; CurrentEditor)))) | (@IsAvailable($RefOptions))
Question by:AliciaVee
  • 3
  • 2
LVL 46

Expert Comment

by:Sjef Bosman
ID: 26126684
Errrrr... don't understand. Can you explain again, maybe with an example? Can you include the Reader and Author fields? What do you want to achieve?

I get the idea that you're trying to do something that is technically possible yet rather dangerous. If your goal is to "allow authors of their own documents to see and edit the document", and you mean to do that by role, I have to warn you that  that won't work. Once you add the role as an Author to a document, ANY person with that role will be able to see and edit ANY document with that role.

I hope I got it wrong...

Author Comment

ID: 26127358
Sjef -- sorry I wasn't clear.  Let me explain:

There are 2  fields to control author/edits in this database as follows:
from -  author field with computed as composed with @username
documentauthors - author field with computred with role called [EditRights]

in access control list:
AuthorGroup - access type: author - and should add and edit their own docs)
ReadGroup - access type: reader - will only be able to read documents
EditGroup - access type: author- will have the role of EditRights applied

Problem to solve: do not let readers see the "Edit Button" on the documents or the "Add Document" button on views

Maybe there is a simplier way?
LVL 46

Accepted Solution

Sjef Bosman earned 2000 total points
ID: 26127867
Users who are supposed to see the Edit button:
- users with the EditRights role
- users without the role but who are Author of the document and at least Author in the ACL

As for the Edit-button: it is not possible in a view, since the visibility is evaluated only once, and not when you move up and down in the view. In the form, the hide-when formula could be:
      !@IsMember("[EditRights]"; @UserRoles) & !(@UserAccess(@DbName)>=3)

The formula isn't complete, but there is no (easy) way to test whether the current user can edit a document.

For the Add Document button: any person with Author rights or better can add documents. Code in the hide-when:

Author Comment

ID: 26129221

Okay -- your comments got me thinking and I now understand.  I used the following to hide the edit button if the person, who has the EditRights role is also the author of the document:
!@Contains(@UserRoles; "[EditRights]" ) & (From != @UserName) ==> and so if the person isn't the author -- but has the edit role -- they will see this edit button, but not the other edit button that is visible to all authors of their own documents:
!(@LowerCase(@Name([CN]; @UserName)) = @LowerCase(@Name([CN]; From)))
(this was in the application -- so I am leaving it and adding a new button)

For views, I kept the following on the "add document" button -- which should work since I have an "authors" role in the acl and both authors group and editors group will have this role applied:

So, I think I'm set -- not the most elequent -- but works!



Author Closing Comment

ID: 31670055
Appreciate the response, feedback and dialogue

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

569 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