7 Replies Latest reply on Aug 31, 2016 7:42 PM by calebhkang

    FM 14 Giving permission based on primary key

    calebhkang

      Hello everyone,

       

      I'm a FM 14 novice here and I've created a database for my church contacts using the starter solution.

       

      So here is my problem:

      Each person in our organization is part of a "small group". And each small group has multiple people (reverse is not true).

      So I used one to many relationship to join "Small group table" (one) and "contacts table" (many).

      "Small group table" contains information of that small group (leader name, start date...) and I use portal to populate the members name and info in that layout.

      I would like to give permission to each group leader so that they can see ONLY their group members' information in their group layout.

      but I'm not sure how I can do that.

      I already have given permission settings that allows them to see only certain parts of data in "contacts table" but giving different permission to different leaders

      seems like this requires a whole new approach...

       

      If I create separate table for each group, would that solve the problem? (The problem would be, how do I enter their group info in Contacts layout?)

      If that is the way to go, how can I differentiate each group? With different primary keys?

       

      Hope this makes sense and thank you in advance!

       

      Caleb.

        • 1. Re: FM 14 Giving permission based on primary key
          dtcgnet

          Simple answer: Do NOT create a separate table for each group.

           

          More complete answer: Though achieving this isn't incredibly complex, it does require a bit of complexity. Do you have a privilege set up for users? One for group leaders? Does each group leader have his or her own FileMaker account? When a user logs in, do you have a startup script that "identifies" that user by finding him in the Contacts table and setting a global field to his Contact ID?

           

          What you're looking for is Record Level Access, so Google that and do some preliminary looking. Then respond back and you'll get good advice on how to achieve what you're after.

          1 of 1 people found this helpful
          • 2. Re: FM 14 Giving permission based on primary key
            cortical

            3 tables would be a start. it doesn't read like you have a GroupContact join table:

            A Contacts

            B Group

            C GroupContact

             

            A

            contact_id

            contact_name

             

            B

            group_id

            group_name

            contact_id (leader)

             

             

            C

            group_contact_id

            group_id

            contact_id

             

             

            Then one could create a utility table (one record), that loaded on startup, set a global to the logged in group leader id

            to establish a relationship to GroupContact

            1 of 1 people found this helpful
            • 3. Re: FM 14 Giving permission based on primary key
              calebhkang

              Thanks, I guess creating different tables is a no go. Good to know.

               

              dtcgnet wrote:

               

              What you're looking for is Record Level Access, so Google that and do some preliminary looking. Then respond back and you'll get good advice on how to achieve what you're after.

              So I did look it up and it looks a lot more complicated than I imagined, since it will involve calculations and scripts. I can definitely look more into it later. I'm wondering though, I need to give privilege access based on whether someone is part of the group or not - is this possible in "record level access??

              • 4. Re: FM 14 Giving permission based on primary key
                calebhkang

                Thanks - No I didnt think I would need join table since I saw it as one-to-many relationship.

                 

                cortical wrote:

                 

                Then one could create a utility table (one record), that loaded on startup, set a global to the logged in group leader id

                to establish a relationship to GroupContact

                So what gets displayed on the startup screen would be the "Contact Group" table?

                What do you mean by setting a "global"?

                • 5. Re: FM 14 Giving permission based on primary key
                  cortical

                  tables would be:

                  A Contacts

                  B Group

                  C GroupContact

                  User (utility)

                   

                  open script goes to layout based on User table - a single record table

                  create a global field g_group_id

                  establish a REL User::g_group_id = GroupContact::group_id  for the portal to list the groupcontacts

                  and an additional REL for to display the contact names in the portal

                  GroupContact::contact_id= Contact::contact_id

                  ie:

                  User- Group-GroupContact-Contact

                   

                  a global field has the same value for all records

                  IF the login name of the leader is the same as the contact record  first/last names for them (or can be mapped accordingly), then you should be able at file open to

                  FIND the contact record for them

                  parse the relevant primary key (contact_id)

                  parse the relevant group_id for the contact_id

                  set etc g_group_id = parsed group_id

                  go to LAY based on User

                   

                  This assumes each leader only has one group (more than one could be dealt with)

                  also assumes ate none of the users, including leaders need to get to any of the other layouts ( this could be dealt with too)

                   

                   

                   

                   

                  1 of 1 people found this helpful
                  • 6. Re: FM 14 Giving permission based on primary key
                    cortical

                    like attached

                     

                    full access as default = admin (no pw)

                     

                    leader login examples:

                    test dummy

                    delores dummy

                    1 of 1 people found this helpful
                    • 7. Re: FM 14 Giving permission based on primary key
                      calebhkang

                      Thank you very much!

                      I think I need to work more on relational database fundamentals - my head is a little bit jumbled up right now

                      but I will be ok - Will eventually get this sorted out once I follow what you just did.

                      Good to know such option is available - thanks!