blissland Posted February 7, 2008 Posted February 7, 2008 i'm new to this and this is probably something that everyone here already does all the time.... i want users to see only the records that they have entered into the db. i'm not sure how to do this, but i've been trying to do it by creating a user field that calculates (get(accountname)) for each record. then, i've tried to create a script that upon login performs a Find on all records with that username. I have not had any luck figuring out how to do that though, and I'm guessing there must be a better, simpler, more standard way to do this.
blissland Posted February 8, 2008 Author Posted February 8, 2008 I think what I'm about to ask is something so simple everyone here already does it, but I'm asking anyway. I simply want to display only the records (for viewing or editing) that are specific to the user that made them. So, I've put a 'user' field into my tables that is calculated by (GET(account_name)). Then I was thinking that I could create a script that would occur after login that did a Find on those records whose user=thecurrentuser. I don't know if that's the right way to go about it, and if it is, I still haven't figured out how to make the Find part of that script do what its supposed to--its stuck searching for the same user (rather than current user) each time. Would love some hints....
Vaughan Posted February 8, 2008 Posted February 8, 2008 Two things need to be done: records needs to have a field which identifies the user that created the record -- a text field that auto-enters the creator account name. Then the file needs to have an account and privileges set up so that the user can only view the record if the record creator matches the current account.
blissland Posted February 8, 2008 Author Posted February 8, 2008 hi, thanks for your reply. in my initial post i mention that i did set up a field that auto-enters the user's account name. then i also mentioned that i need to figure out how to set it up so only that user's records show. i'm asking HOW do i do the latter. I've gone into accounts/priv but I don't see how to do this since it seems to filter access by table and layout, not by record.
Søren Dyhr Posted February 8, 2008 Posted February 8, 2008 Guiseppe Pupita have made a template dealing with these matters, I do not agree with the method, since it can be circumvented, by turning the debugger on! http://www.buliga.it/TipFiles/Gateway7EN.zip Instead would I explore if it weren't posible to give each user his own table, which then is 1-to-1 related to the common datatable, so each users table only holds one field the relational keyfield, browsing thru records is then done from that perspective. --sd
blissland Posted February 8, 2008 Author Posted February 8, 2008 hi, that's an interesting idea to make different tables for different users. if i want to summarize data across users, might that complicate matters? or no?
Søren Dyhr Posted February 8, 2008 Posted February 8, 2008 No not particularly - just use GetSummary( and the summaryfield in both paramters in the command, the summary field needs then to be in the common table. There can be some refreshing issues you might solve with this: http://www.briandunning.com/cf/390 ...not that I've in any way have tried any of this yet, I just brainstormed here...! --sd
comment Posted February 8, 2008 Posted February 8, 2008 Guiseppe Pupita have made a template dealing with these matters, I do not agree with the method, since it can be circumvented, by turning the debugger on! Then why bother with it, when there is a simple method that meets the requirement, as mentioned by Vaughan. I've gone into accounts/priv but I don't see how to do this Create a privilege set for users. In this set, choose 'Custom privileges' for Records. For each relevant table, define the View privileges (at least) as limited, and enter the condition: Get ( AccountName ) = AccountName where AccountName is the field that auto-enters the account name. See also: http://www.fmforums.com/forum/showtopic.php?tid/181085/
_henry_ Posted February 8, 2008 Posted February 8, 2008 Hi Blissland, Could you show your Find' script?
bcooney Posted February 8, 2008 Posted February 8, 2008 Actually, the way to go about this is by using record level access privileges.
_henry_ Posted February 8, 2008 Posted February 8, 2008 Hi Bcooney, I saw this thread on another his similar thread. I am not sure if this thread has any connection with another one. So I am just asking what kind of Find' script he has. If you are saying the access level privilege like Get (AccountName) or Get (PrivilegeSetName), it means that he could ask in http://fmforums.com/forum/showtopic.php?tid/193106/
bcooney Posted February 8, 2008 Posted February 8, 2008 Perfect link, henry. I think this is what the OP needs.
_henry_ Posted February 8, 2008 Posted February 8, 2008 Thank you Bcooney I was reading his another thread and saw this thread. So, it would be better for him to ask in the same thread instead of creating a new one :)
Lee Smith Posted February 8, 2008 Posted February 8, 2008 Hi Barbara, I merged the two topics. and will notify the OP.
blissland Posted February 8, 2008 Author Posted February 8, 2008 thank you. this was most helpful and works well. the link you sent me too didn't work as well for me as it never allowed me to put that equation into the calculation....i also think its cleaner doing it your way without having to add a field to all of the tables.
bcooney Posted February 8, 2008 Posted February 8, 2008 you DO have to add a field to every table, the field that autoenters the creator's AccountName.
blissland Posted February 8, 2008 Author Posted February 8, 2008 BTW, is there a way to copy/paste it rather than retyping it? Find All Records Perform Find [Omit Records where 'user'=""] I wasn't sure if i needed to do a findall first or not. Anyway, this seems to work--do you see any problem with doing it like this? A Better way?
comment Posted February 8, 2008 Posted February 8, 2008 the link you sent me too didn't work as well for me as it never allowed me to put that equation into the calculation I included that link so you can read about how Find and GTRR behave with restricted access records. The method suggested at the beginning of the thread is dubious, at least.
blissland Posted February 8, 2008 Author Posted February 8, 2008 got it. i guess either method is the same in that regard. good point.
blissland Posted February 8, 2008 Author Posted February 8, 2008 yes, that was VERY cool to know that about Find and restricted access records. i couldn't really think of a find that would be like a 'find all'...maybe something where recordID isn't empty, but i don't see how one specifies empty or nonempty.
Recommended Posts
This topic is 6134 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 accountSign in
Already have an account? Sign in here.
Sign In Now