10 Replies Latest reply on Nov 11, 2013 7:34 AM by lamp

    user access

    lamp

      Title

      user access

      Post

           Dear All,

           I have a database with all my clients. The tables are Company  and query.

           Each client has its own queries. for example

           Company1 = query1+2+3+4+5...

           Company2 = query1+2+3+4+5...

           Company3= query1+2+3+4+5...

            

           Is there any way I can give access to user he/she can only see his/her company records?

           If I restrict a user I only give access to fields on File->Manage->Security->privilige Set. I can't access to a record.

           Please let me know if you need more details.

           Thanks in advance

            

           Lamp

        • 1. Re: user access
          philmodjunk

               More detail may be necessary, but...See "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis" for a description of how to set up access controls that limit access record by record.

          • 2. Re: user access
            lamp

                 Dear PhilModjunk,

                 Thanks a lot. it worked.

                 Is there any way I can setup, restricted user should be able to see only his/her records. I don't want he/she see "no access" records.

                  

                 Thanks

                 Lamp

            • 3. Re: user access
              philmodjunk

                   Any script performed by a script or the user will automatically omit "no access" records.

                   Set up a script to perform a find automatically. This can be a script set in File Options to run "onFirstWIndowOpen" or you can use the OnLayoutEnter trigger on the layout.

                   One possible script: (substitute your names for my placeholders)

                   #This script finds all records that the current user is permitted to access
                   Go to Layout ["LayoutbasedonYourTable" (YourTable) ] --> don't need if you use OnLayoutEnter
                   Enter Find Mode[] --> clear the pause check box
                   Set Field [YourTable::AnyNeverEmptyField ; "*" ]
                   Set Error Capture [on]
                   Perform Find []

                   With that script working, the only way a user can get "no access" records is through Show All Records or Show Omitted Only. If you have FileMaker Advanced, you can add a custom menu that either omits these menu options or that performs your own scripts (such as the "show all permitted" script shown above.) in place of the standard menu options.

              • 4. Re: user access
                lamp

                     Thanks. I have users with full access. Is there any way I can put "IF" statement. If the user is restricted run find if not work as normal.

                     Thanks

                     Lamp

                • 5. Re: user access
                  philmodjunk

                       If [ Get ( accountPrivilegeSetName ) = "[Full Access]" ]

                       But giving other users a truly [Full Access] password is dangerous. It's pretty easy for them to accidentally change the design of your database...

                  • 6. Re: user access
                    lamp

                         Can I use that on all scripts?

                         if [ Get ( accountPrivilegeSetName ) = "[Full Access]" ]

                          

                         I appreciate your help. it was great

                         Thanks a lot.

                         Lamp

                    • 7. Re: user access
                      philmodjunk

                           You can use it anywhere that you need to detect the user's privilege set name. But keep in mind that for Full access users, the script I suggested does the same thing as "Show All Records" and thus you may not really need to do something different when a full access user opens the file.

                      • 8. Re: user access
                        lamp

                             Here is my script. It does not work. ignores If [Get....] at all.

                             When I click on button does nothing.

                             Go to layout [original layout]

                             If[Get ( AccountPrivilegeSetName ) = "restricted"]

                             Enter Find Mode[]

                             Set Field [Company::Company Name; Company::Company Name ="testCompany"]

                             Perform Find[]

                             Go to Related Record [From table:"Query 5"; Using layout "Query"(Query)]

                             Else

                             Go to Related Record [From table:"Query 5"; Using layout "Query"(Query)]

                             End If

                             Can you help please.

                              

                             Thanks

                             Lamp

                        • 9. Re: user access
                          philmodjunk

                               I can only guess that at the time the script executes, there are no related records via the relationship from your layout's Tutorial: What are Table Occurrences? to the Query 5 table occurrence. GTRR does nothing but return an error code if a layout is specified by name and there are no related records. The script will execute as though the GTRR step wasn't even there.

                               Go to Layout [original layout]

                               doesn't look correct for the first line of a script. That step returns a script to the layout that was current at the time executing started so it doesn't do anything as the first step in a script.

                               I would check first to make sure that you are on the correct layout when the script starts executing, then double check the relationship from that layout's table occurrence to Query 5.

                          • 10. Re: user access
                            lamp

                                 The way my database is nested as follow

                                 Table "Company" and "Query"

                                 Each company has its won queries. on company layout I have two portals setup. one for open quires calls "Queries 5" and other for closed quires "Quires List done".

                                 On the relation for "Quires 5" is (CompanyId=CompanyId And gToDoOnly=done).

                                 The script button is in the Company layout.

                                  

                                  

                                 Thanks

                                 Lamp