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

Security - getting down to basics ...

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

    Security - getting down to basics ...

    I have been struggling to understand how to use xbasic to add and edit users to the security framework. I have been looking at this for months and hate to say, still have very little luck.

    In an effort to get down to the very basic, I have put the following code in to an a5w page. Can anyone please explain to me why this would not work?

    dim request.variables.userid as c
    'dim request.variables.email as c
    session.userid="Dr. John"
    session.password="xyzz1234"

    dim request.variables.password as c

    request.variables.userid = session.userid
    'request.variables.email = "[email protected]"
    request.variables.password = session.password

    dim request.variables.groups as c
    request.variables.groups = "Administrators,EnterEditButNoDelete,ViewOnly"

    dim output as p
    dim output.controls as p
    dim output.controls.guid.value as c

    dim result as p
    dim error_message as c
    dim group_list as c
    result = a5ws_Save_User_Values(output,request)

    if result.errors = .T. then
    error_message = result.error_text
    end
    end if

    user_guid = output.controls.guid.value

    Essentially, all I am tryning to do is add a new user by the name of Dr. John, with a password, and assigned to several groups. When I run this page in my local webroot, it apears to run without error, but no record is added to the security.

    I am really lost ...

    Gary
    Gary S. Traub, Ph.D.


    #2
    Re: Security - getting down to basics ...

    I just can't seem to get my arms around this.

    Is there something very complicated about this or am I just not seeing the forest through the trees?

    Is there a straightforward, easy way to add a new user via xbasic to the security framework.

    Suppose this:

    userid="Dr. John"
    password="xyzz1234"
    groups="Administrators,EnterEditButNoDelete,ViewOnly"

    Simply, what is the command to add this user to the framework??

    Gary
    Gary S. Traub, Ph.D.

    Comment


      #3
      Re: Security - getting down to basics ...

      The code does seem to run, but the user is not getting added to security. I am testing this on my local webroot. Is that a problem?
      Gary S. Traub, Ph.D.

      Comment


        #4
        Re: Security - getting down to basics ...

        A couple of quick checks
        1. Are you fields in the dialog scope LOCAL ?
        2. Do these groups have permission to access the correct pages.

        Note find the associated websecurity dbfs
        eg websecurity_expired
        websecurity_groups
        websecurity_members
        websecurity_no_import
        and websecurity_users

        I suggest you look but don't touch these manually etc.
        Check to see has _users actually got a guid in it and other values password etc.
        next check that members has two guids as a pair, one for the user and the other guid for a group.

        let us know how you get on. :-)

        Comment


          #5
          Re: Security - getting down to basics ...

          If you add or edit a user from a web form they do not show on the desktop users and groups form. This link explains the process.

          Comment


            #6
            Re: Security - getting down to basics ...

            Colin,

            Thanks for helping. I am not sure I understand some of your questions though:

            1. Are you fields in the dialog scope LOCAL ?
            I am running this script directly from a web page

            2. Do these groups have permission to access the correct pages.
            which groups?

            Note find the associated websecurity dbfs
            eg websecurity_expired
            websecurity_groups
            websecurity_members
            websecurity_no_import
            and websecurity_users

            I suggest you look but don't touch these manually etc.
            Check to see has _users actually got a guid in it and other values password etc.
            next check that members has two guids as a pair, one for the user and the other guid for a group.
            done - all seems okay

            Thanks again Colin.
            Gary S. Traub, Ph.D.

            Comment


              #7
              Re: Security - getting down to basics ...

              If you add or edit a user from a web form they do not show on the desktop users and groups form. This link explains the process.

              Jerry,

              I must have a mental block but I really do not understand.

              What do you mean by a web form? Whether I run the code from an a5w page, or form a dialog, and run either of them locally i.e. by publishing and opening the page with "launch browser after files are published, page to show", I still do not see the user added to security.

              This is the code in the a5w page:

              dim request.variables.userid as c
              dim request.variables.email as c
              session.userid="Dr. John"
              session.password="abcd1234"

              dim request.variables.password as c

              request.variables.userid = session.userid
              'request.variables.email = "[email protected]"
              request.variables.password = session.password

              dim request.variables.groups as c
              request.variables.groups = "Administrators,EnterEditButNoDelete,ViewOnly"


              dim output as p
              dim output.controls as p
              dim output.controls.guid.value as c

              dim result as p
              dim error_message as c
              dim group_list as c
              result = a5ws_Save_User_Values(output,request)

              if result.errors = .T. then
              error_message = result.error_text
              end
              end if

              user_guid = output.controls.guid.value

              What is wrong with this code?



              Gary
              Gary S. Traub, Ph.D.

              Comment


                #8
                Re: Security - getting down to basics ...

                Your code, with slight modification to fit my environment, worked fine to add a user. This info will help:

                - put in some debug code as follows so you can actually see the error if any:
                ...
                if result.errors = .T. then
                error_message = result.error_text
                ?"My Error: " + error_message
                end
                ...

                If you run your script as is, it should report an error with your userid.

                - Your session.userid CANNOT include any embedded spaces.
                - Run this at the top of your code, or on a different test page:
                ?a5ws_user_file_field_list()

                This will tell you what fields Security expects. Your's may be different, mine looks like this:

                Email Guid Password RememberMe Ulink Userid

                Not all of those are mandatory, but Email, Password, Ulink and Userid are mandatory. So my add-user code needs to include them.

                - You need to know if your userid expects a phrase or an email address and provide the appropriate format.

                - You have to run your test page in your published project location (e.g. LocalHost), not in LivePreview or elsewhere.

                -------------------------------------

                To explain what Jerry said,

                In any Alpha web app there are THREE sets of users.

                1. Desktop which controls access only to a Windows GUI desktop app and has no connection to the web security.
                2. The set of security files modified under Web Control Panel > Web Security > Users and Groups.
                3. The set of web security files in EACH of your published locations, including LocalHost.

                So if you run your test script above in LocalHost, it will add that user to the security files found in LocalHost, it will NOT affect the files found in Web Control Panel > Web Security > Users and Groups, and visa versa.
                Steve Wood
                See my profile on IADN

                Comment


                  #9
                  Re: Security - getting down to basics ...

                  Steve,

                  Thank you SO much for that explanation. It is beginning to make sense. I just succesfully added a user!

                  What is the xbasic to assure that the various user tables are in synch?

                  Thanks again!!!!!!!!!

                  Gary
                  Gary S. Traub, Ph.D.

                  Comment


                    #10
                    Re: Security - getting down to basics ...

                    What is the xbasic to assure that the various user tables are in synch?
                    That's a good question! I don't have a script, but am working on it.
                    Steve Wood
                    See my profile on IADN

                    Comment


                      #11
                      Re: Security - getting down to basics ...

                      Hi Steve,

                      So if I understand this correctly, I have a few questions about how to make sure the users that are added are not inadvertently overwritten.

                      For example, if I add users to my remote server. Then, I make changes to the program on my notebook, republish to the local webroot, and then copy the a5webroot from laptop to remote server. It seems this would overwrite the security files and thus delete any new users.

                      Am I correct about this? If so, what do you recommend?

                      Gary
                      Gary S. Traub, Ph.D.

                      Comment


                        #12
                        Re: Security - getting down to basics ...

                        Originally posted by drgarytraub View Post
                        ... republish to the local webroot, and then copy the a5webroot from laptop to remote server. It seems this would overwrite the security files and thus delete any new users.

                        Am I correct about this? If so, what do you recommend?
                        Gary,

                        See Jerry's post #5 above, The link he gives answers your question.
                        Peter
                        AlphaBase Solutions, LLC

                        [email protected]
                        https://www.alphabasesolutions.com


                        Comment


                          #13
                          Re: Security - getting down to basics ...

                          I've never copied from LocalHost to a server, but yes you would overwrite everything including any users who registered since. Once you have a live website with user's doing stuff, you need to take special precautions.

                          You could just not copy any websecurity*.* files, but again, I've never experimented with this.
                          Steve Wood
                          See my profile on IADN

                          Comment


                            #14
                            Re: Security - getting down to basics ...

                            Dr Gary,
                            You are right I was so eager to answer the question that I didn't read your post properly

                            Regards
                            Colin

                            Comment


                              #15
                              Re: Security - getting down to basics ...

                              Hi Colin,

                              Your input and comments were helpful nonetheless. Thanks!

                              Gary
                              Gary S. Traub, Ph.D.

                              Comment

                              Working...
                              X