6 Replies Latest reply on May 4, 2011 2:22 PM by shudder

    Admin Access Only on Part of Database

    ZoocMan85

      Title

      Admin Access Only on Part of Database

      Post

      Hey everyone... I have a main menu on my datebase i created. I have a button on there that says admin . How do i set the button to verify the user account ? What i wanna do is have that poriton only accesssed by a user who has admin access. How do i go about doing this? Thanks

       

      Ray Z

        • 1. Re: Admin Access Only on Part of Database
          philmodjunk

          Get ( AccountName ) will return the name of the user's account--such as Admin.

          Get ( AccountPrivilegeSetName ) will return [Full Access]  (brackets included) if the person has the database open with full access privileges.

          • 2. Re: Admin Access Only on Part of Database
            ZoocMan85

            So if i was to write this in a script... What would it look like. Sorry dude im a noob! Thanks for your help.

            • 3. Re: Admin Access Only on Part of Database
              philmodjunk

              You'd use one or the other in an If script step. Using the second get function:

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

                 // put any script steps that you want to take place when the button is clicked and they have full access here

              End If

              This assumes you have FileMaker 11, as this was a new function added with that release. If you are using an older version, you'd use Get ( PrivilegeSetName) instead.

              You can also use conditional formatting to specify a grey text color when the current user is not a full access user so that the button looks "disabled".

              Use this expression for a "formula" conditional format:

              Get ( AccountPrivilegeSetName ) ≠ "[Full Access]"

              And specify a dark grey text color instead of black.

              • 4. Re: Admin Access Only on Part of Database
                ZoocMan85

                Ok i did all that and it works great however, if you pick the layout from the layout list above ....you can still get to it. How do i resolve that?

                • 5. Re: Admin Access Only on Part of Database
                  philmodjunk

                  Use Manage Layouts to clear the check box that includes this layout in the drop down list available while you are in browse mode or go to the layout and use Layout Setup... to clear the same check box.

                  You can also use settings in Manage Security so that the entire layout is grayed out for users that aren't full access just in case they find a way around all this and get to this layout anyway.

                  • 6. Re: Admin Access Only on Part of Database
                    shudder

                    Additionally, I add a gatekeeper section to the script so that when the button is clicked by non-Admin users they get a dialog telling them as much, as follows (assumes admin users are in the "Admin" privilege set...):

                    If [Get ( CurrentPrivilegeSetName ) ≠ "Admin"]
                        Show Custom Dialog ["Not an Admin"; "It appears you are not an admin user..."]  
                        Halt Script
                    End If

                    I utilize only the Default Button in the dialog, so if they get into the If stmt by being non-Admin, then the Halt Script will hit after they click the button in the dialog, and the Halt step stops the script from running.  

                    With that If section up top in a script, normal users won't get past the gatekeeper. 

                    hth

                    - shud