1 2 Previous Next 15 Replies Latest reply on Jul 24, 2017 3:50 AM by beverly

    How to assign records to different users

    thekops

      Hi, I am still quite new to filemaker. I am trying to make a user database where different users will login using their individual username and password. and immediately after logging in, they will be able to view their profile page. However, currently, the different records created are not owned by any users. (As any user can currently just switch records to view other user profile.) I have created a user table, with fields such as "Username, password,

      I have created a user table, with fields such as "Username, password, email and priority" Do anyone know how to assign the users to their individual records??. Thanks:)

        • 1. Re: How to assign records to different users
          mikebeargie

          So you already created a users table, and assumably you have filled out "Username" with the filemaker account names of your users. You're already on the right track!

           

          At this point, you should probably setup security privileges for those user accounts. Creating a "User" privilege set, then assigning that privilege set to your users is the first step.

           

          Next, set the User privilege set to only allow access to records in the "user" table based on a calculation of:

          Get(AccountName) = user::Username

          This will restrict access to those records and only allow filemaker users assigned the "User" privilege set to see the record they are associated with. Your account (left on the [full access] privilege set) will be able to see all users. You can even create an "admin" privilege set to allow special users to access and edit other users records if needed.

           

          Check out this helpful video that covers those security settings:

          User Specific Privileges - ISO FileMaker Magazine

           

          Once you have done that, in your login script or as a trigger script on your user table layout, just do a simple find script like so:

          Set Error Capture [ on ]

          Allow User Abort [ off ]

          Enter Find Mode [ no pause ]

          Set Field [ user::Username ; "==" & Get(AccountName) ]

          Perform Find

          # CHECKS FOR IF A RECORD EXISTS, KICKS THEM OUT IF NOT.

          If[ Get(LastError) = 401 ]

             Show Custom Dialog [ "ERROR" ; "Your Account was not found, please contact an administrator" ]

             Close File [ Current File ]

          End If

          • 2. Re: How to assign records to different users
            coherentkris

            if you are new to FM then i would suggest NOT storing usernames and passwords in a table and trying to make that work as record level security. It is better to learn the standard account security settings and what they can do for you to control things. FM security settings are very powerful once you dive in and get to know them.

            • 3. Re: How to assign records to different users
              thekops

              Hi, how do you set the standard account security?

              • 4. Re: How to assign records to different users
                mikebeargie

                I linked you to a how-to video on how to set security. Did you watch it?

                • 5. Re: How to assign records to different users
                  thekops

                  Yes, I did:) Sorry Mike, I am a little confused here. Actually, I am trying to assign individual records in a layout to individual users. Is it still the same??

                  • 6. Re: How to assign records to different users
                    coherentkris

                    The reason that I suggested to use the built in security functionality because using layout controls to produce record level security is a complex issue and is easy to circumvent if not done properly. If you lock users out at the data layer it does not matter what layout they are on they will never be able to see what you dont want them to see.

                    1 of 1 people found this helpful
                    • 7. Re: How to assign records to different users
                      philmodjunk

                      Actually, I am trying to assign individual records in a layout to individual users. Is it still the same??

                      To assign a record to a user, put their account name into a text field. Often, this is done with an auto-enter field that auto-enters the creators account name in order to assign records to the person that created the record, but you can set this up however you need--even putting a list of account names or a privilege set name into a field to assign a record to a user or group of users.

                      • 8. Re: How to assign records to different users
                        thekops

                        Sorry, I am a little confused here. Is the auto-enter field in the layout or must I create an account and set the privilege for it?

                        • 9. Re: How to assign records to different users
                          philmodjunk

                          No to both questions. The auto-enter field does not need to be placed on any layout though you can if you want to and it's probably a good idea at least while testing your setup to confirm that it works.

                           

                          So you define a text field in Manage | Database | Fields to auto-enter the account name.

                           

                          Any existing records will need to be updated to add account names via other methods either by typing in names or via Replace Field Contents or possibly a script. Any NEW records will auto-enter the current account name when they are created.

                           

                          You can then enter a "record access expression" in manage | security such as:

                           

                          Get ( AccountName ) = AccountNameField

                           

                          More sophisticated methods may be employed, based on this same method, that allow you to grant access to groups of users records.

                           

                          Please see the resources provided earlier on how to set up Manage | Security for such Record Level Access Control.

                          • 10. Re: How to assign records to different users
                            thekops

                            Can you do that on a layout with my records? And assigning the records each to an individual user??

                            • 11. Re: How to assign records to different users
                              philmodjunk

                              If you are asking me to do it for you, no.  (On vacation right now)

                               

                              If you are asking "is it possible to do this", yes.

                              • 12. Re: How to assign records to different users
                                mikebeargie

                                Here's the documentation on that:

                                Defining automatic data entry | FileMaker

                                 

                                When you are managing the fields in your table, double click on a text field you create for "creation user"

                                 

                                Then select the "creation" checkbox and select "account name" from the dropdown.

                                 

                                Whenever a record is created, filemaker will auto-enter the account name of the user creating the record into that field.

                                 

                                Screenshot attached.

                                • 13. Re: How to assign records to different users
                                  William-Porter

                                  thekops wrote:

                                   

                                  I am trying to make a user database where different users will login using their individual username and password and immediately after logging in, they will be able to view their profile page. However, currently, the different records created are not owned by any users. (As any user can currently just switch records to view other user profile.) I have created a user table, with fields such as "Username, password,

                                  I have created a user table, with fields such as "Username, password, email and priority" Do anyone know how to assign the users to their individual records??. Thanks:)

                                   

                                  Before I voice my agreement with everything that has already been suggested, I have to ask?

                                   

                                  What exactly are you trying to accomplish? WHY do you need this Users table where users can view their personal profiles? What's the point of that table?

                                   

                                  You mention you want Username, Password, Email and "Priority" (whatever that is). I can understand your desire to prevent user A from seeing the email address of users B, D and C. I'm just curious why user A needs to see her OWN email?

                                   

                                  If the answer is, "So she can change it when it needs to be changed," well, that's fine, although if you were my client, I'd want at this point to have a little chat about why there are email addresses for users in the database at all. (May be a strong reason to do this, but it's not obvious.) Do you plan to have lots of other info in this table, info you haven't yet mentioned?

                                   

                                  Will

                                  • 14. Re: How to assign records to different users
                                    thekops

                                    Before I voice my agreement with everything that has already been suggested, I have to ask?

                                     

                                    What exactly are you trying to accomplish? WHY do you need this Users table where users can view their personal profiles? What's the point of that table?

                                     

                                    You mention you want Username, Password, Email and "Priority" (whatever that is). I can understand your desire to prevent user A from seeing the email address of users B, D and C. I'm just curious why user A needs to see her OWN email?

                                     

                                    If the answer is, "So she can change it when it needs to be changed," well, that's fine, although if you were my client, I'd want at this point to have a little chat about why there are email addresses for users in the database at all. (May be a strong reason to do this, but it's not obvious.) Do you plan to have lots of other info in this table, info you haven't yet mentioned?

                                     

                                    Will

                                    As mentioned in my initial post, I am new to FileMaker. And do not know the proper/better way to create a database so  I did some research on the forum and saw some users using this method, hence trying it out. THANKS so much for your input:)

                                    1 2 Previous Next