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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

Using Roles in Author fields

Hi,

I am trying to use the following code in an Author field on a form:

@If(
site_country = "UK";  @UserName : "[UK]";
site_country = "Australia";  @UserName : "[Australia]";
site_country = "India";   @UserName : "[India]";
site_country = "China";  @UserName : "[China]";
site_country = "Malaysia";   @UserName : "[Malaysia]";
site_country = "Japan";   @UserName : "[Japan]";
site_country = "Germany";   @UserName : "[Germany]";
site_country = "South Africa";   @UserName : "[South Africa]";
"[Admin]")

Although this is seemingly valid, it doesn't seem to work as I would like.

What I am trying to achieve is to make documents only editable if the country matches the role, or if they were the original document authors.

If the site_country field doesn't match any of the listed countries I want it to be assigned role of "[Admin]"

The site_country field is a computed text field.

This is for Notes Client 6.53

Thanks.
0
shuboarder
Asked:
shuboarder
  • 7
  • 5
  • 2
  • +2
4 Solutions
 
SysExpertCommented:
Where is the problem ?

1)  Are the contents of the Autor field correctly set ?
2) If the Author field is set correctly, is the person, and anyone in that country ACL able to edit ?

Please provide more details of the isse.

I hope this helps !
0
 
shuboarderAuthor Commented:
Hi SysExpert,

1) when a new document is created it is setting Author field to [Admin]

Once the site is selected from the comobobox this is changing to something like:

John Smith ; [UK]

These seems to be ok?

2) When I create a new document it assigns role [Admin]
This should mean that only people with role of [Admin] can edit it.
However it seems that it is still editable by anyone. i.e. [UK]
0
 
Steve KnightIT ConsultancyCommented:
Not sure what your issues is specifically but, probably because I'm lazy for repeat typing, I'd probably lay it out slightly differently as:

sitelist:= "UK": "Australia": "India": "China" etc...
@If(site_country=sitelist;@UserName:"[" + site_country + "]");[Admin]);

As SysExpert says what are the issues?  Presume the roles are defined in the ACL and users assigned to them on the remote replicas etc. (I assume server per country).  Silly question too but are local replicas involved at all?

Steve
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Steve KnightIT ConsultancyCommented:
Previous post being typed while your reply came in...

If it is editable by anyone then either there is another author field, the user has the role or editor in ACL etc.  Try it as a normal user and see what @UserRoles resolves to or click the button in the toolbar to see what roles are assigned.  Presumably the user involved is only an author in the ACL?
0
 
shuboarderAuthor Commented:
All of the roles in the ACL have editor access

i.e. India group has editor access with role of editor.
Does this override the role itself?

I have added a reader field with the same formula, and this appears to be preventing the document from appearing now. Can I hide the category of the country as well?
0
 
shuboarderAuthor Commented:
Thinking about it, this would make perfect sense.

Everyone has author access until the author field gives them editor access.

Is that correct?

Can anyone help me further by explaining how I might get rid of the category that displays the document

Country
           Site
                 Description
                                 Document

Currently the document part is working in that people that shouldn't be able to edit it can't even see it.
How can I also not display the 3 categories leading up to this document?

Thanks

                 
0
 
SysExpertCommented:
I would definitely set the users to Author rather than editor as a start.
Also, are there any other Author/reader fields in the form ?

Unless you enforce a consistant ACL( Advanced setting in ACl )  , Then anyone with a local copy wil be able to do anything.

I hope this helps !
0
 
shuboarderAuthor Commented:
I have set the groups to Author access now.
I can't see any other author/reader fields on the form, but does this necessarily mean they do not exist?
Constant ACL is being enforced already - thanks
0
 
Steve KnightIT ConsultancyCommented:
Hang on did you say the role has Editor access in the ACL?  You should have something like:

UserGroupUK  Author
UserGroupAustralia Author
Admins Manager

then the UserGroupUk (or individuals listed) has UK role ticked
and UserGroupAustralia (or individuals listed) has Australia role ticked

then in the document you give the role Author access to it so if the user is in UK group they get Uk role and author access (i.e. they can edit) the UK documents.

Have you got [UK] type role entries listed directly in the ACL?

At no time should editor access be needed for this -- even if someone needs access to all areas you could do it by giving them all the relevant roles through a group or directly.

Steve
0
 
Steve KnightIT ConsultancyCommented:
<<Currently the document part is working in that people that shouldn't be able to edit it can't even see it.
How can I also not display the 3 categories leading up to this document?>>

There is a property on the view (4th or 5th tab, cna't remember off hand) "don't display catgeroies with zero documents" which should do that.
0
 
Steve KnightIT ConsultancyCommented:
Re: the Readers field be careful.  A readers field specifies exactly everything that can see the document.  I always add an extra readers field with an admin role / server name or role listed aswell in case the main one gets corrupted etc. especially when it is a computed field like this as otherwise you could easily 'lose' documents that you can't see either.  

If you have a readers field you MUST be in that field to get any kind of access to the document at all.
If an only if you are an author in the ACL then an authors field allows you to edit that document.

hth

Steve
0
 
Sjef BosmanGroupware ConsultantCommented:
Formula correction:
    sitelist:= "UK": "Australia": "India": "China" etc...
    @If(site_country=sitelist;@UserName:("[" + site_country + "]"));[Admin]);

I'm too tired to read all your comments, but: an Authors field only works when someone has Author rights to begin with. You can NEVER turn a Reader into an Author, nor can you prevent an Editor from changing a document even if he's not mentioned as an Author.
0
 
marilyngCommented:
sjef has the formula correct, except for a typo in the Admin :

     sitelist:= "UK": "Australia": "India": "China" etc...
    @If(site_country=sitelist;@UserName:("[" + site_country + "]"));"[Admin]");



0
 
Steve KnightIT ConsultancyCommented:
Actually I think we all had a typo or two - I had left a bracket and to quotes out and now there is an extra bracket.  Think this is it :-)

sitelist:= "UK": "Australia": "India": "China" etc...
    @If(site_country=sitelist;@UserName:("[" + site_country + "]");"[Admin]");




0
 
marilyngCommented:
Sorry, didn't read all the way to the top, yeah, slap those nasty pda's for making the screen too small to see the typos.
0
 
Steve KnightIT ConsultancyCommented:
Thanks for the points.... will hit that first 50,000 in TA yet :-)
0
 
shuboarderAuthor Commented:
Thank you!

I've kept my original formula as it works for me...

It was just the access level in the ACL that needed changing and the "don't display empty categories" 3rd tab in the view properties that needed checking.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 7
  • 5
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now