Jump to content
Sign in to follow this  
BeththeNewbie

Using Account information to secure records

Recommended Posts

Here's the scenario:

Once my clients have authenticated via an external server, I would like write a script in which the Account Username would do 2 things:

Populate a field named "Teacher" in on of my layouts (LessonPlanner).

Do a find that looks up all the records with that Account Username as "Teacher" in that particular layout.

I know that I will have to add an extra step for first time users in the script which will populate the "Teacher" field with the Account Username and request new record.

On top of all of this, I would like to find a way in which users would only be able to read/write their own records, and keep all others as read only.

Any ideas from the scripting pros?

Beth Bedeker

Share this post


Link to post
Share on other sites

Instead of using the account name, use the privilege set name. It'd be a snap if it was "teacher". Then use "Get( PrivilegeSetName ).

Share this post


Link to post
Share on other sites

All of my teachers have the same privilege set. I was looking to use their account name so that they could only access their own records.

Share this post


Link to post
Share on other sites

Oh, you have a field named "Teacher".

"I was looking to use their account name so that they could only access their own records."

For that, each record needs a field in it with the account name of the user that "owns" it -- it's probaly the person that created it, but not necessarily so. Let's call this field "Owner".

Then set up the privilege set to limit the viewing of the records to [ Get( AccountName ) = Owner ].

At startup, perform find for all records where [ Owner = Get( AccountName ) ].

Because the privilege set is set to only show a user's records, even if they do a Show All Records they won't be able to see anybody else's data.

Share this post


Link to post
Share on other sites

This process is called Record Level Access, and following Vaughan's good advice here will allow you to set up a system that works.

You might search this forum for that term or go on over to FMPug and sign up for a Real Tech membership and inquire more on this topic.

Steven

Share this post


Link to post
Share on other sites

...go on over to FMPug and sign up for a Real Tech membership...

I'll second that!

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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