Jump to content
Server Maintenance This Week. ×

Get User and NOT Creator


McG

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

Recommended Posts

I want to have users log into database with user id, and they are then presented with their own record which they can edit. My way of doing this is rather convoluted, and I always thought it would be something straightforward using get(accountname). However, get(accountname) returns the account who created the record (which is always done by Admin), and not the user logged on. Is this correct? I attempted a script that checked whether user id matched get(accountname), but always got no match.

So. is there a variation of the get command (or something else) that allows me to find the user logged on and not the user who created the account?

Thanks for any help (using FMP10A).

Link to comment
Share on other sites

If you want to have a user log in and navigate to a specific record, then that record must have a value in it that identifies it as "their" record.

Get (AccountName) matched to AccountCreated field works, as you've discovered, if the current logged in user is the one to create the record. In your case, all records are created by account Admin.

So, you need a field in the table, such as AssignedTo, that matches your user. AssignedTo would contain the UserID.

I typically have a Users table. The table has __kP_UserID (primary key) and Name_Last, Name_First, AccountName, PrivSet, email, etc.

In a startup script, I use a routine that finds in Users for Get (AccountName). Now, I'm on the User's record. I have their UserID. I can now go to related record anywhere by using a relationship from Users to AnyTable by UserID.

hth,

Barbara

Link to comment
Share on other sites

Thanks Barbara, I have it all functioning perfectly now. I did have a solution before which used much of what you suggest, but I had many layers of extra (unnecessary) complex also included.

No more!

Thanks again.

Link to comment
Share on other sites

Just be sure that one user cannot see the records of other users, if that is a restriction you want to implement. The system you describe [color:red]does not do that.

Also, maybe take a look at this FM Forums article for additional considerations.

Steven

Link to comment
Share on other sites

This topic is 5160 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.