4 Replies Latest reply on Mar 25, 2015 12:41 PM by sportyguy209

    Security Script Step

    sportyguy209

      Title

      Security Script Step

      Post

      I have a database created so that it starts up as a guest with limited layouts (no user name/password). I want to be able to create a button that a manager can click on, enter his/her user name/password and go to a specific layout. If the user name/password is incorrect it will go back to the original layout.

      Then, when the manager is done with the layout, I want another button that the manager can click on to take it back to the guest settings with the original layout.

      What is the best way to accomplish this? TIA

        • 1. Re: Security Script Step
          philmodjunk

          Take a look at the Re-Login script step--you can look it up in help. This step would seem made to order for what you want to do. Something like:

          Set Error Capture [on]
          relogin
          If [ Not Get ( LastError ) ]
             Go to Layout
          End IF

          A more sophisticated script can do this in a loop and you can check the actual error code returned to distinguish between the user clicking cancel and incorrect credentials. Also, you can add code inside the if step that checks account or privilege set names to determine if the credentials used are those that allow access to the other layout.

          And it would be a good added layer of security if you use Manage | Security to limit access to this other layout to only accounts with certain privilege sets. That way, if the user finds a way to get to that layout in spite of your interface design, they get a grey screen that read "no access" instead of seeing the actual layout.

          • 2. Re: Security Script Step
            sportyguy209

            Thanks. I tried this, but if you hit cancel after the script starts to run, it takes you to the "manager" layout which is the one I want to use for the correct password. How do I get it to default to the original layout? TIA

            • 3. Re: Security Script Step
              philmodjunk

              That should not be the case. When you click "Cancel" in the password dialog, a nonzero error code is returned--the value 1. (You can look up error codes in FileMaker Help.)

              Not  Get ( lastError ) will evaluate as False and thus will not result in a change in layouts as only a zero error code result will allow the script to change layouts.

              So you'll need to take a closer look at your script to figure out why that didn't happen when you clicked "Cancel".

              • 4. Re: Security Script Step
                sportyguy209

                Thanks, I had the layouts in the incorrect order. That worked!