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

a5ws_Delete_User()

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

    a5ws_Delete_User()

    Has anyone used this method?

    a5ws_Delete_User() - Delete a web security user from the current project. The user_value entered to delete can be a user 'guid' or a user 'userid''. The function can be used on the desktop in a web page or component. A 'request' pointer must be provided if run in a web page or component.

    I found this in the release notes (and another unfinished thread) but nowhere else.

    I have a lot of users who come and go and maintenance is of a huge concern.

    What component did you use?
    Did you set it up to delete ALL of the user's records in your various tables?
    Actual script examples? :)

    Any directions would be appreciated.

    Thanks
    Eric

    Alpha Five Websites
    longlivepuppies.com
    socialservicenetwork.com
    -------------------------------------------------
    socialservicenetwork.org

    #2
    Re: a5ws_Delete_User()

    This works when placed directly in the a5w page or CanDeleteRecord event of a grid

    a5ws_Delete_User(session.__protected__userid)

    I created a delete user grid where the user can go if user wishes to delete his/her account. The grid has the delete function. In the CanDeleteRecord event I have a5ws_Delete_User(session.__protected__userid). When the user clicks the delete button and submit, the user's account is deleted from the security database.

    Within this same grid, you can also create functions to delete all the user's records in any of your other databases.
    Last edited by EricN; 03-05-2008, 03:59 PM.
    Eric

    Alpha Five Websites
    longlivepuppies.com
    socialservicenetwork.com
    -------------------------------------------------
    socialservicenetwork.org

    Comment


      #3
      Re: a5ws_Delete_User()

      Hi,

      I see that this is an old thread, but I am trying to create a grid to celete users as per your message above.

      How can I create a grid to show users (I can't relate it to a DBF file). Any suggestion or sample code on how to delete users from the web?

      Any help is appreciated

      Andy Sigrist

      Comment


        #4
        Re: a5ws_Delete_User()

        Hello Andy,

        I no longer use a grid for this. I give my registered user the option to delete the account. If he decides to do this, he can choose "Yes" which directs the user to a delete page containing a lot of code. What you may be interested in is this:

        ' ===== Users table Delete Records =====
        dim tbl as P
        tbl = table.open("[pathalias.adb_path]\users")
        query.filter = "Userid =" + quote(session.__protected__userid)
        query.order = "Recno()"
        qry = tbl.query_create()
        tbl.delete_range()
        qry.drop()
        tbl.close()

        a5ws_Delete_User(session.__protected__userid)

        ' Overkill?
        a5ws_logoutuser(session,request,response)

        dim session.__protected__userid as c = ""
        dim userid as c = ""
        dim session.Company_name as c = ""
        dim session.First_name as c = ""
        dim session.last_name as c = ""
        dim session.permissions as c = ""
        Eric

        Alpha Five Websites
        longlivepuppies.com
        socialservicenetwork.com
        -------------------------------------------------
        socialservicenetwork.org

        Comment


          #5
          Re: a5ws_Delete_User()

          Eric,

          thank you for the very quick reply and for the code. However, I don't know how to use it. Do I put it as XBasic code on a A5W page or does it go into a component?

          I tried to use the code, but can't make it work. Any further suggestions or samples?

          Andy

          Comment


            #6
            Re: a5ws_Delete_User()

            Originally posted by Sigrist View Post
            Do I put it as XBasic code on a A5W page or does it go into a component?
            It depends upon your circumstances. e.g. If you have a grid of users, you can put this code in the grid's CanDeleteRecord event (btw: this is v10 code):
            Code:
            function CanDeleteRecord as v (DataSubmitted as P, Args as p, PageVariables as p, Result as P)
            WITH PageVariables
                Result.Cancel = .f.
                Result.ErrorHTML = ""
                
                'delete the security user
                dim request as p
                dim session as p
            
                DIM vResults as L
            
                request = args.GridDefinition.request
                session = PageVariables.session
            
                vResults = a5ws_Delete_User(DataSubmitted.USER_NAME,request)
                IF vResults = .f.
                    Result.Cancel = .t.
                    Result.ErrorHTML = DataSubmitted.USER_NAME+" was not deleted"
                END IF
                
            END WITH
            end function
            In the above example the grid has a field called USER_NAME (which corresponds to security's user_id).
            ===
            Oops! Just realized this is the v8 forum, so the above code may be useless to you. Sorry.
            Peter
            AlphaBase Solutions, LLC

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


            Comment


              #7
              Re: a5ws_Delete_User()

              Hello Andy,
              This is my page minus script not related to this question. I copied this page and here it is. It is NOT in a grid, this is an .a5w page with only code in it. On my account page, I have to option to delete his account. If clicks, "Yes," then this page is activated (behind the scenes without user seeing it). User then redirected to page thanking him for initially trying out my site. His registration in my database AND security are deleted. Hope this helps.

              <html>
              <head>
              <title>User Delete Account SSN</title>
              </head>
              <body>
              <%a5

              ' ===== Users table Delete Records =====
              dim tbl as P
              dim qry as P
              tbl = table.open("[pathalias.adb_path]\users")
              query.filter = "Userid =" + quote(session.__protected__userid)
              query.order = "Recno()"
              qry = tbl.query_create()
              tbl.delete_range()
              qry.drop()
              tbl.close()

              a5ws_Delete_User(session.__protected__userid)

              a5ws_logoutuser(session,request,response) ' logs out user so can't access login required pages

              dim session.__protected__userid as c = ""
              dim userid as c = ""
              dim session.Company_name as c = ""
              dim session.First_name as c = ""
              dim session.last_name as c = ""
              dim session.permissions as c = ""

              %>
              </body>
              </html>
              <%a5 a5w_include("Z_Footer.a5w") %>
              Last edited by EricN; 05-31-2010, 12:47 PM.
              Eric

              Alpha Five Websites
              longlivepuppies.com
              socialservicenetwork.com
              -------------------------------------------------
              socialservicenetwork.org

              Comment


                #8
                Re: a5ws_Delete_User()

                Peter, Eric,

                I really appreciate your help, but I am totally lost.

                I consider myself a reasonably competent A5 programmer, but I just can't figure this out, even with your help.

                Couple of questions:

                How do you create a grid of users (data from GUID)?
                What does the page and code look like of "If clicks, "Yes," then this page is activated"?

                Appreciate any further help and guidance of this.

                Andy

                Comment


                  #9
                  Re: a5ws_Delete_User()

                  Andy,
                  I know this is tough. I've been there. I did a lot of trial and error before things began to "click"

                  Below are pics of my grid (in design mode). Not pretty but works.

                  Every user has his personal "Home Page." In this home page are several links. One of them is:
                  url = "Delete_Account.a5w?"
                  display = "<font color=#3c61d1 face=arial size=2><strong>Delete Account</strong></font>"
                  ? "<a href=" + url + ">" + display + "</a>"

                  This brings the user to another page with the grid (pics below). Once the user clicks the, "Delete Entire Account Now" button, the next page, "Account Delete Process" is called and runs. (see pic #2) This "Account Delete Process" page contains the code that I already posted on post #7. The user does NOT see this. Once the page runs, the user is directed to my thanks page --> response.redirect("thanks.a5w")

                  The account is completely deleted.

                  FYI: I know you can put the code (post #7) into your grid events page and eliminate the code only page, but this is how I do it.
                  Last edited by EricN; 06-01-2010, 01:33 AM.
                  Eric

                  Alpha Five Websites
                  longlivepuppies.com
                  socialservicenetwork.com
                  -------------------------------------------------
                  socialservicenetwork.org

                  Comment


                    #10
                    Re: a5ws_Delete_User()

                    Eric,

                    thank you for your help once again. I am getting a lot closer by have, hopefully, one last question.

                    What DBF file is the grid built on. Is it the User Security DBF file on the server (GUID)?

                    Sincerely

                    Andy Sigrist

                    Comment


                      #11
                      Re: a5ws_Delete_User()

                      Grid is connected to my users.dbf

                      a5ws_Delete_User(session.__protected__userid) is connected to the security
                      Eric

                      Alpha Five Websites
                      longlivepuppies.com
                      socialservicenetwork.com
                      -------------------------------------------------
                      socialservicenetwork.org

                      Comment


                        #12
                        Re: a5ws_Delete_User()

                        Originally posted by EricN View Post
                        Grid is connected to my users.dbf
                        Andy,

                        What Eric is saying is that you have to create your own user's grid and code that to security, so that both are in synch.
                        Peter
                        AlphaBase Solutions, LLC

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


                        Comment


                          #13
                          Re: a5ws_Delete_User()

                          See below pic.

                          This is the grid I use. Table name is connected to my users table
                          I defined an argument Userid=:Userid When the grid is called, the argument is activated. The grid finds the user whos userid (session.__protected__userid) equals the argument. When it finds the correct record in the dbf, the fields in the grid are populated.

                          This grid does nothing to delete any of the user's records. I use it because I hope the user tells me why he wishes to delete his account. Once he clicks "Delete Entire Account Now," this information is sent to be via email and then the user is redirected to the Account Delete Process page which he does not see.

                          Again, instead of using my approach, you could place a5ws_Delete_User(session.__protected__userid) in the events of your grid to delete your user and not create a code only page. But if you have another database that contains your user's information (like I do), you will want to create a way to delete that also. I do that by the ' ===== Users table Delete Records ===== in my post #7 above.

                          I have a code only page because I have over 300 lines of code and that is too difficult to maintain in a grid.
                          Last edited by EricN; 06-01-2010, 04:43 PM.
                          Eric

                          Alpha Five Websites
                          longlivepuppies.com
                          socialservicenetwork.com
                          -------------------------------------------------
                          socialservicenetwork.org

                          Comment


                            #14
                            Re: a5ws_Delete_User()

                            Eric, Peter,

                            I really do appreciate your help, but I am still stuck.

                            I actually think that I was fairly close with what I initially intended to do. I originally created a Dialog that displays a User List from the published security file.

                            I then tried to add the "delete" function to the validate event of the submit button. See attached picture.

                            My intend was that the administrator can highlight a user in the dialog, then press the submit button (labeled "Delete User") to delete the specific user.

                            In the picture you can see that I tried all variations of the a5ws_Delete_User() function, but so far without success.

                            Am I on the right track and what would be the correct syntax for the a5ws_Delete_user() function in this case?

                            Andy Sigrist

                            Comment


                              #15
                              Re: a5ws_Delete_User()

                              Originally posted by Sigrist View Post
                              Am I on the right track and what would be the correct syntax for the a5ws_Delete_user() function in this case?
                              In your image you show this:
                              a5ws_Delete_user(session.__protected__)
                              That won't do anything.

                              The next line might be ok, if you populate the variable first. If not, it won't do anything either.
                              a5ws_Delete_user(session.__protected__userid)
                              Peter
                              AlphaBase Solutions, LLC

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


                              Comment

                              Working...
                              X