Jump to content

Best calculation for custom record privileges?


RPEugene

This topic is 3494 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Apologies if this question has been answered elsewhere. I scanned previous posts and couldn't find this specific question.

I want to set up a custom record privilege that allows certain users to edit a particular record. I would like the following types of users to be able to edit a given record:

1. The user who created the record

2. Other users to whom I (the administrator) give permission.

Currently, I have a field called "EditorApproved" in which I can place usernames (other than creator) of those who may edit the record. Ideally, I'd like the permission calculation to scan for the presence of the username in the EditorApproved field and allow them to edit the record.

For now, I only have the calculation (aCreatedBy = Get ( AccountName ).

How can I modify this calculation such that it will test the above and also check EditorApproved against Get ( AccountName )? Ideally, I'd like the EditorApproved field to be able to hold multiple usernames, although it's not essential -- I can create EditorApproved01, EditorApproved02, or repeating fields I suppose.

Thanks for any tips! confused.gif

Link to comment
Share on other sites

Use a Boolean in custom record privileges (Records can be viewed when, edited when, etc.), like:

Let ( name = Get ( AccountName ) ;

name = a(CreatedBy) or name = EditorApproved01 or name = EditorApproved02

)

Link to comment
Share on other sites

Thank you, transpower, for your solution. It works like a charm!

Now, not to be greedy, but is there a way that I can have a single field ("EditorApproved") into which I can enter multiple names (perhaps through checkboxes) and employ a calculation that will scan EditorApproved for the required account name?

If not, no big deal.

Again, thanks!

Link to comment
Share on other sites

An idea (that I cannot test at the moment since I'm away from the database). . .

If we assume that EditorApproved contains a list of account names that are entered via checkbox set (and are therefore return-delimited), might the following work?

Let ( name = Get ( AccountName ) ;

name = aCreatedBy or name = FilterValues (EditorApproved ; name )

)

Link to comment
Share on other sites

Hmmm. . . I finally had a chance to test it out. It allows the creator (aCreatedBy) to edit just fine, but the AccountNames called by the FilterValues doesn't seen to work. Any names in the EditorApproved field simply invoke the "Your access privileges do not allow to perform this action" error message. I wonder what I'm overlooking here. . .

Link to comment
Share on other sites

  • 9 years later...

Hello,

 

I know this thread is very old, but I think it almost cracks the case of my own user access control conundrum.

 

I am developing a private practice database for practitioners to house their patient data. Sometimes the primary record creator will be the only one that is permitted to access a particular patient record, but that practitioner might choose to share that record with another practitioner.

 

I have set up a separate table called "user access control" and have this table displayed as a portal in the patient record where additional users can be added by Account Name.

 

This is working great for the first person entered into the portal, however, secondary to that row, the formula below is not working.

 

Let ( name = Get ( AccountName ) ;
name = User Account Name or name = PatternCount (User Account Name ; name )= 1
)
 
I am pretty sure I'm close, but need a bit of assistance to polish this off!
 
I look forward to any assistance or thoughts.
 
Best regards,
 
Tim
Link to comment
Share on other sites

This is working great for the first person entered into the portal, however, secondary to that row, the formula below is not working.

Let ( name = Get ( AccountName ) ;

name = User Account Name or name = PatternCount (User Account Name ; name )= 1
)

 

Those guys 10 years ago were on the right track, but didn't finish it properly:

not IsEmpty ( FilterValues ( Get ( AccountName ) ; List ( User Access Control::User Account Name ) ) )
Link to comment
Share on other sites

Thank you so much for your reply and code eos.

 

I replaced the original code with what you provided and I am still getting the same result (user in row 1 has access, however anything second to that is still <No Access>.

 

I will investigate table setups and relationships and see if I can get it to fire up with your code.

 

Many thanks once again :)

 

Best regards,

 

Tim 

Link to comment
Share on other sites

A cautionary note about this process.

 

You want to be sure that the values in the List cannot be manipulated such that someone could add himself/herself to that list, or potentially remove someone else from the list who is supposed to be authorized.

 

Steven

Link to comment
Share on other sites

This topic is 3494 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.