10 Replies Latest reply on May 25, 2010 11:34 AM by daveealex

    Button Visible by privilege set?

    daveealex

      Title

      Button Visible by privilege set?

      Post

      I have created a button that leads to a layout to enter news, I want to put next to the portal I have created one my default page. This portal will list all the new news. The button needs to be visible only by the admin group and one other person(I can create another privilege set for him). I am not sure how to go about this. I think I can  create another default page with the button, but how can I make it the default page only for the admin and this user/ privilege set?

        • 1. Re: Button Visible by privilege set?
          fitch

          The functions you can use to test in your startup script are:

           

          Get(AccountName) and

          Get(AccountPrivilegeSetName)

          • 2. Re: Button Visible by privilege set?
            daveealex

            Mr. Fitch,

             

            Thank you for the the response. I have created this script from the info you have given me and it does work. It seems very simple. I would just like to have it checked to make sure it is secure/good enough to place on a live database. 

             

            Set Error Capture [ On ]
            If [ Get ( AccountName ) = "admin" ]
            Go to Layout [ “newsPortal” (newsPortal) ]
            Else
            Go to Layout [ “home” (home) ]
            End If

             

            Please let me know what needs to be modified. Thank you in advance.

            David



            • 3. Re: Button Visible by privilege set?
              mrvodka

              What version are you using?

              • 4. Re: Button Visible by privilege set?
                daveealex

                11 pro advance

                • 5. Re: Button Visible by privilege set?
                  mrvodka

                  You do not have to create a second layout for this.

                   

                  If you are using 11 you can do simply the following:

                   

                  • Create a 1 line portal with no line, pen patterns, etc.
                  • Put the button in the portal.
                  • Put on a portal filter of: Get ( AccountPrivilegeSetName ) = "AdminGroup" ( Use account name if you are checking for specific account name ).

                   

                   

                   

                  Here is an example of the modernized visiblity trick.

                   

                  http://fmforums.com/forum/showtopic.php?tid/214599

                   

                  • 6. Re: Button Visible by privilege set?
                    daveealex

                    Thank you for the response Mr. Vodka. When i create the portal and add the button, i can see the button in browse mode. When i add the filter the button disappears. It is clickable but completely invisible to all users. If i click on the invisible button as admin group it takes me to the data entry page, if i click on it as non admin it takes me to the no access page which it would do normally. I am able to replicate LaRetta's example with no problem. When I add the code:      not IsEmpty (visable11 2::text1 )  & Get ( AccountPrivilegeSetName ) = "Admin"      I loose the fuctionality of the field. The

                    not IsEmpty (visable11 2::text1 ) is Laretta's original code and it does work when it is alone. It seems that you have to use some sort of a field in the portal such as a text field(date field) and not a button. I am still learning Filemaker so alot of my scripting is trial and error and It seems to me that I am doing something very wrong with the button and the Get ( AccountPrivilegeSetName ) = "Admin" filter.  I am not asking to be spoon fed here but I can not get it to work.

                     

                    David

                    • 7. Re: Button Visible by privilege set?
                      mrvodka

                      All you need is: Get ( AccountPrivilegeSetName ) = "AdminGroup".

                       

                      You do not need the not IsEmpty (visable11 2::text1 )

                       

                      If the filtered porta; does not have anything to show, the button itself will go away if it is indeed within the boundaries of the portal.

                       

                      BTW,

                       

                      not IsEmpty (visable11 2::text1 )  & Get ( AccountPrivilegeSetName ) = "Admin" will be true if either of those statements are true because you are using a &, which is a concatenation instead of the logical operator of AND.

                       

                      So if visable11 2::text1 is not empty but the priv set is Read only then the equation will result in the following:

                      1 & 0, which is 10, and in boolean logic TRUE.

                       

                      As opposed to using AND which will result in 1 AND 0, which is FALSE as both are not true in boolean logic.

                      • 8. Re: Button Visible by privilege set?
                        daveealex

                        Mr. Vodka,

                         

                        I just can not get it to work. Sorry to keep this going but Its driving me crazy. When i use a text field I have no problems. Here are some images so you can see my work. The first one is the relationship, the second is the filter and the portal setup and the third is the no button in the browse mode. I do have an account at fmforums if you would like to see my file.

                         

                        David

                         


                        • 9. Re: Button Visible by privilege set?
                          mrvodka

                          Sure you can send me a Private message on fmforums with a copy of the file but I have a feeling that your Privilege set name is not "Admin". I have a feeling that your user account may be that but that your privilege set may be [Full Access].

                           

                           

                          • 10. Re: Button Visible by privilege set?
                            daveealex

                            Mr.. Vodka,

                             

                            It works, I was trying to set by user and not privilege set. You were correct!! So stupid on my part!!  Thank you for your help.

                             

                            David