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

Restricting access to individual record

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

    Restricting access to individual record

    Hi

    I have a login section to my site (btw - thanks Steve, for a great login component) and want my customers to be able to view and amend their personal details only, within it.

    I have created a grid component but I'm not too sure how to restrict the customer to only view and amend their own record.

    Any thoughts would be appreciated.

    Thanks

    Duncan

    #2
    Re: Restricting access to individual record

    Duncan,

    From page 6 of the documentation that came with that component, printed here for anyone else reading this:

    Filtering data in your grid

    The login screen does not automatically filter data for any of your grid components, but it does give you the ability to do so. The LoginDialog includes a field named �username�. This was created as a �session variable�, and as such, the value in this field is available from any page in your application. If your user logged in with �Dave�, then session.username = �Dave�.

    You can use session.usename to restrict the user to just their own data.

    For example, an A5W page that displays a grid containing user information would include the following filter statement (assuming your table included a field named Customer_ID):

    DBF.filter = "Customer_ID = \""+session.username + chr(34)

    or

    DBF.filter = "Customer_ID = "+quote(session.username)

    Make this entry inside the grid's WITH statement in the A5W page. It should look like this when done (assuming your grid name is ("Customer"):

    with tmpl_customer
    ... other statemnts
    DBF.filter = "Customer_ID = "+quote(session.username)
    ... other statemnts
    end with

    Note: You can also enter this statement when inserting the component on the A5W page. Click Insert Component and then check the box Override any of the component settings.
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: Restricting access to individual record

      Thanks for your reply Steve, but I have entered the code in the with statement and it still brings up a number of records.

      !doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">

      <head>

      <%a5
      a5w_include("logintest.a5w")
      %>

      <%a5
      Delete tmpl_customer_detail
      DIM tmpl_customer_detail as P
      tmpl_customer_detail = a5w_load_component("customer_details")
      'Following code allows you to override settings in the saved component, and specify the component alias (componentName property).
      'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short.
      'Each component on a page must have a unique alias (componentName property).
      with tmpl_customer
      componentName = "customer_details"
      DBF.filter = "Username = "+quote(session.username)
      end with
      '=======================================compute the HTML for the Component=======================================
      delete x_customer_detail
      dim x_customer_detail as p
      tmpl_customer_detail.request = request
      tmpl_customer_detail.session = session
      tmpl_customer_detail.response = response
      tmpl_customer_detail.serversetting = serversetting
      tmpl_customer_detail.PageVariables = local_variables()
      x_customer_detail = a5w_run_Component(tmpl_customer_detail)
      '=============================================================================================================
      if x_customer_detail.RedirectURL <> "" then
      response.redirect(x_customer_detail.redirectURL)
      end
      end if
      ?x_customer_detail.Output.Head.JavaScript
      ?x_customer_detail.Output.Head.CSS_Link
      %>
      <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
      <!--CSS for tmpl_customer_detail -->
      <link rel="stylesheet" type="text/css" href="file:///C:\Program Files\A5V7/css/topbriefings/style.css">
      <!--Alpha Five Temporary Code End -->

      Any thoughts

      Thanks

      Comment


        #4
        Re: Restricting access to individual record

        I think you modified this line:

        with tmpl_customer

        and it should have remained as:

        with tmpl_customer_detail
        Steve Wood
        See my profile on IADN

        Comment


          #5
          Re: Restricting access to individual record

          I made the corrections and the relevant record now shows, but there is also a blank record displayed as well - not sure how to get rid of it.

          Have found the solution - just needed to change the grid component to show no new records.

          Thanks

          Duncan
          Last edited by gotobedd; 07-05-2006, 12:26 PM.

          Comment


            #6
            Re: Restricting access to individual record

            I am attempting to use your example to rescrict access to a record , where would I insert the code if my code looks as follows:

            <%a5
            Delete tmpl_GridLinker
            DIM tmpl_GridLinker as P
            tmpl_GridLinker = a5w_load_component("assformcomp")
            '=======================================compute the HTML for the Component=======================================
            delete x_GridLinker
            dim x_GridLinker as p
            tmpl_GridLinker.request = request
            tmpl_GridLinker.session = session
            tmpl_GridLinker.response = response
            tmpl_GridLinker.serversetting = serversetting
            tmpl_GridLinker.PageVariables = local_variables()
            x_GridLinker = a5w_run_Component(tmpl_GridLinker)

            Any help will be appreciated

            Thank-you

            John

            Comment


              #7
              Re: Restricting access to individual record

              You are inserting a GridLinker component, and they are treated differently than the example below, which is a straight Grid component insert. In the case of a grid linker, open the grid linker component and select the grid you wish to filter (normally the topmost) and click the Edit button. You then see a button for Override Settings. Click that and enter code similar to what we used below, something similar to:

              DBF.filter = "MyField="+quote(session.MyValue)

              or

              DBF.filter = "MyField=" ' MyValue ' " (without the spaces)

              Putting this same code in the A5W page, as you would to filter a grid, has no effect. But this is similar to how you can filter parent or child records in a SET on the desktop side.
              Steve Wood
              See my profile on IADN

              Comment


                #8
                Re: Restricting access to individual record

                Hi Steve

                Thanks once again for you help

                I have put the following code in on the override properties

                DBF.filter = "assessor="+quote(session.username)

                But get this error when trying to access the page

                500 Internal Server Error
                Script Error
                Error:Script:TEMPLATE line:30
                DBF.filter = "assessor="+quote(session.username)
                Property not found
                session.username subelement not found.

                Any ideas what I am doing wrong?

                Thanks

                John

                Comment


                  #9
                  Re: Restricting access to individual record

                  You obviously have not set session.usename. This normally gets set in the LoginDialog as one of the controls. But this also depends on how you designed your login. If you are just testing this gridlinker page, don't forget to go through your standard login process where username would most likely get set. Another way to just test it, is to put this statement in the top of your A5W page that contains the filter:

                  session.username="myuser"

                  That way, the variable will esist. Also, a secondary point, you are supposed to always test for existance of a variable before using it. Else your users may someday get this same message. You test for existance using

                  if eval_valid("session.username") then
                  - your code that uses session.username
                  else
                  - what you would do if the variable was not valid
                  end
                  Steve Wood
                  See my profile on IADN

                  Comment


                    #10
                    Re: Restricting access to individual record

                    Thanks Steve

                    Got it working now, it was the session.username that had been mispelled

                    Thanks Again

                    John

                    Comment


                      #11
                      Re: Restricting access to individual record

                      hi, i am trying to restrict records and am using the code



                      but am getting this error. this is my first attempt at a5w.

                      500 Internal Server Error
                      "Script Error
                      Error:Script: /mem_details.a5w line:59
                      DBF.filter = "member_ID = "+quote(session.username)
                      Property not found
                      session.username subelement not found."
                      i have checked the names of the fields and all seems ok.

                      any help please

                      thanks

                      richard

                      Comment

                      Working...
                      X