Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Button Security with groups and users

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Button Security with groups and users

    Hello All,
    Is there a way to assign a group allowed to click a button like delete?

    I can assign group access to forms, but cannot see how to apply using xbasic to a button. I do not want to use password on a button function.
    As it stands that means I have to create a delete form and assign the user group that can access that form with the delete button like user group managers or only the administrative user.

    Due to this lack of knowledge I have had to create duplicate forms each with only the buttons I want that user group to have access to. Its not logical and would be simpler to use the user groups and have the group assigned to a button or buttons.

    I have
    view forms
    edit forms
    add forms

    managers group have all access to all forms
    data entry group have access to the add forms and view forms
    employees only have access to the view forms

    My form named "sites"uses a set called "sites set"

    'Execute menu command: '!a5_sec_set_dialog("Sites@C:\myproject\sites set.set","Form")'.
    a5_sec_set_dialog("Sites@C:\myproject\sites set.set","Form")

    The button on that form I want to secure being "delete button" to delete a site has an object code of CONTROL_BUTTON8

    If someone has an answer and if they could please provide a line of code that allows assigning to a button would be great!

    Thank you,
    Paul

    #2
    Re: Button Security with groups and users

    In the properties of the button can't you just go to the Security Groups section and check the box for the corresponding group? Only members of that security group would be able to access and see it.
    securitygroups.JPG
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

    Comment


      #3
      Re: Button Security with groups and users

      Paul,

      a5_get_user_assignments("<master password", "user") will return a list of groups the user is in.
      you could put this in the code behind the button to enable/disable the button functionality

      see https://www.alphasoftware.com/docume...20Function.xml

      Comment


        #4
        Re: Button Security with groups and users

        If you don't want to password protect buttons, and I can understand the awkwardness of that, there are a couple of alternatives.
        You could create a global variable in the autoexec which used A5_GET_USER_ASSIGNMENTS() to populate it with the groups to which user_name() is assigned.
        You could then start each button's code with

        if "Administrator" !$ thatgolbalvariable 'or other group name
        end
        end if

        so that the button does nothing if the user is not part of the proper group.

        Alternatively you could have each "sensitive" button placed in a conditional object on a pane where the condition is

        "Administrator" $ thatgolbalvariable

        so that only those who are allowed to use the button ever see it.
        There can be only one.

        Comment


          #5
          Re: Button Security with groups and users

          Originally posted by CharlesParker View Post
          In the properties of the button can't you just go to the Security Groups section and check the box for the corresponding group? Only members of that security group would be able to access and see it.
          I don't see the Security Groups option/section using the Desktop version. There is an Enabled and a Visible property that can be set dynamically.
          There can be only one.

          Comment


            #6
            Re: Button Security with groups and users

            dang it stan you caught me again answering in the desktop section with a web development reply - sorry!
            NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

            Comment


              #7
              Re: Button Security with groups and users

              Another option which I do is to put something like this in the forms OnActivate event.
              This code greys out and disables the button.

              autoexec script:

              Code:
              DIM GLOBAL vcUser as C
              vcUser = user_name()
              '--vcUser is one of:  admin, billing, office, mechanic, parts

              Form OnActivate event:

              Code:
              '-- Disable Delete button for user who is logged in as "Parts"
              
              if inlist2(var->vcUser, "Parts") = .t. then
              	control_button8.Border.Color  = "Gray-25"
              	control_button8.Font.Color  = "Gray-25"
              	control_button8.disable()
              end if
              Alpha 5 Version 11
              AA Build 2999, Build 4269, Current Build
              DBF's and MySql
              Desktop, Web on the Desktop and WEB

              Ron Anusiewicz

              Comment


                #8
                Re: Button Security with groups and users

                Originally posted by CharlesParker View Post
                dang it stan you caught me again answering in the desktop section with a web development reply - sorry!
                No blood, no foul.


                Thanks for trying.
                There can be only one.

                Comment


                  #9
                  Re: Button Security with groups and users

                  Originally posted by Ronald Anusiewicz View Post
                  Another option which I do is to put something like this in the forms OnActivate event.
                  This code greys out and disables the button.

                  autoexec script:

                  Code:
                  DIM GLOBAL vcUser as C
                  vcUser = user_name()
                  '--vcUser is one of:  admin, billing, office, mechanic, parts

                  Form OnActivate event:

                  Code:
                  '-- Disable Delete button for user who is logged in as "Parts"
                  
                  if inlist2(var->vcUser, "Parts") = .t. then
                  	control_button8.Border.Color  = "Gray-25"
                  	control_button8.Font.Color  = "Gray-25"
                  	control_button8.disable()
                  end if
                  So I could use transparent so they don't see anything I assume other than the form background?
                  VCuser is the security user groups created in alpha?
                  I have buttons where the owner of the software would define the groups and buttons to define access to forms as they see fit.

                  Everyone has given some food for thought here to try and play with I hope.

                  Thank you!

                  Paul

                  Comment


                    #10
                    Re: Button Security with groups and users

                    If you don't want is seen

                    control_button8.hide()
                    There can be only one.

                    Comment


                      #11
                      Re: Button Security with groups and users

                      VCuser is arbitrary as far as what the name of it is. In the Code Dim VCuser as c stan is simply namng a variable to hold whatever value is after the = sign.
                      If he wrote
                      Dim Vbarnyardanimal as c
                      Vbarnyardanimal = username()
                      then you could use that in the code
                      if inlist2(var->vcUser, "Parts") = .t. then to read
                      if inlist2(var->Vbarnyardanimal, "Parts") = .t. then
                      and it would result in the same.


                      At least that's what it appears to be to me code-wise in this case even though I do not do desktop applications, this looks like regular xbasic.
                      NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                      Comment


                        #12
                        Re: Button Security with groups and users

                        Originally posted by Stan Mathews View Post
                        If you don't want to password protect buttons, and I can understand the awkwardness of that, there are a couple of alternatives.
                        You could create a global variable in the autoexec which used A5_GET_USER_ASSIGNMENTS() to populate it with the groups to which user_name() is assigned.
                        You could then start each button's code with

                        if "Administrator" !$ thatgolbalvariable 'or other group name
                        end
                        end if

                        so that the button does nothing if the user is not part of the proper group.

                        Alternatively you could have each "sensitive" button placed in a conditional object on a pane where the condition is

                        "Administrator" $ thatgolbalvariable

                        so that only those who are allowed to use the button ever see it.
                        Hi Stan,
                        So where I allow the owner to create user groups and users, how could I allow the owner to define what group gets access to a button like delete?
                        Under this I would want the owner to assign rights to a delete button, edit button, and save button. Everyone would have access to normal record navigation, just need to protect the major button.

                        Thank you,
                        Paul

                        Comment


                          #13
                          Re: Button Security with groups and users

                          Originally posted by CharlesParker View Post
                          VCuser is arbitrary as far as what the name of it is. In the Code Dim VCuser as c stan is simply namng a variable to hold whatever value is after the = sign.
                          If he wrote
                          Dim Vbarnyardanimal as c
                          Vbarnyardanimal = username()
                          then you could use that in the code
                          if inlist2(var->vcUser, "Parts") = .t. then to read
                          if inlist2(var->Vbarnyardanimal, "Parts") = .t. then
                          and it would result in the same.


                          At least that's what it appears to be to me code-wise in this case even though I do not do desktop applications, this looks like regular xbasic.
                          Dah, I see that now.
                          I need to use the actual user groups created inside alpha that the admin user creates

                          Thanks for pointing that out!

                          Paul

                          Comment


                            #14
                            Re: Button Security with groups and users

                            My thinking was that the same security group process as used for the rest of the application would suffice for button access. They would set up groups (can_del, can_edit, and can_save) and assign users to those groups.

                            Then as suggested earlier

                            You could create a global variable in the autoexec which used A5_GET_USER_ASSIGNMENTS() to populate it with the groups to which user_name() is assigned.

                            dim global whch_bttns as C
                            whch_bttns = A5_GET_USER_ASSIGNMENTS("themasterpassword,user_name())

                            Then each button (delete, edit, or save) would be coded to check whether the current user was part of the can_del, can_edit, or can_save groups - either by xbasic or dymanic property.
                            There can be only one.

                            Comment


                              #15
                              Re: Button Security with groups and users

                              Thanks Stan!
                              I'll give your approach a try and see if I can get that part working.

                              Thank you again as usual you come to the aid of the newcomers.

                              Paul

                              Comment

                              Working...
                              X