5 Replies Latest reply on Jan 9, 2013 7:24 AM by philmodjunk

    Scipt Help

    Annette

      Title

      Scipt Help

      Post

           Hi....

           I am working with a database that already has some scripts which I need to alter slightly.  As they are at the moment they work fine.  But I would like to add a bit of security into it and I'm just not sure how to write it out or where exactly in the script to put it.  I will copy the existing script below but will explain first. 

           At the moment when they are on a particular layout, the user selects the line in a portal they would like to enter information for and press a button which runs the script opening a new layout.  What I would like to do is add a piece that looks up the title of the person on my "People" table from the "Service" field and if their service is ABC and they selected a line that says ABC then it opens up the layout as required from the script.  But if their service does not match the line selected then it does nothing. 

           The script is in the screenshot attached. 

      script.JPG

        • 1. Re: Scipt Help
          philmodjunk

               Do you use passwords to control access to your database? If so, all authorized users can be given the same privilege set or two.

               Then this code can control whether or not the script does anything:

               If [ Not IseEmpty ( FilterValues ( List ( "[Full Access]" ; "Manager" ) ; Get ( AccountPrivilegeSetName ) ) ) // User's privilege set permits this ]

               Put your current script steps here

               End If

               The user privilege set names for permitted users are what you put in quotes inside the List function.

          • 2. Re: Scipt Help
            Annette

                 Phil,

                 Yes passwords are used to access the database but I don't think that is what I'm trying to do.  MOST of the database everyone can view, but there are certain sections that only people within that profession can view which is what I'm trying to do here.  Everyone can see info to a point...but when say a Psychologist goes to enter staff activity, only other pscyhologists are allowed to view this area.  A speech therapist cannot.  Which is why on the layout they select the line in the portal which applies to their profession, click the button which runs the script and it takes them to professional info for that record.  Several professionals will have information on a record but they do not share it. 

                 You follow me?

            • 3. Re: Scipt Help
              philmodjunk

                   Yes I follow you.

                   It does not change my previous suggestion. All people of a given profession would be given the same privilege set. You then use scripts as well as the privilege set settings to control what they can do and what they can see. You wanted a script to only work for certain users. My script example does exactly that. It keeps anything from happening when the user does not have a privilege set name that is a member of the approved list of privilege set names.

                   You can also use custom settings inside the privilege set to control which scripts may be executed by users with that privilege set, but this will likely produce an error message: "your access privileges do not allow this" or some such message while the script example I gave simply makes that button unresponsive to mouse clicks when a user that does not have privileges clicks it.

              • 4. Re: Scipt Help
                Annette

                     Ok....please forgive me for my ignorance and my total lack of scripts knowledge. 

                     What I did was created a Privilege Set called OT Staff.  So when the user selects the portal row which contains OT in the Service field and presses the button I want it to open........I know you understand me, I'm just also trying to drill it into my own head how this works.....

                     So I added the line you gave above to the beginning of my current script but it's not working.  I know it's just that I am applying this wrong because I'm clueless...again...sorry  :(

                      

                • 5. Re: Scipt Help
                  philmodjunk

                       If the privilege set name is "OT Staff" use "OT Staff" NOT "[OT Staff]". "[Full Access]" is the privilege set name returned when a user logs in with a full access acount such as the default "admin" account. Don't see any use for "OT" in your script step unless you created a second privilege set with OT as its name.

                       You might also: 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 more on how you can use Manage | Security to control access to specific records or groups of records.