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

Detail view with security

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

  • Detail view with security

    Is there a way to have the detail view only show to people that are in a certain security group?

    I can set the edit/delete/insert to security groups but I would like to be possible to even block people from opening the detail view it they don't need to. I am working with Alpha5 V12 and IIS

    Thanks
    Roelof
    Last edited by Atta; 03-11-2016, 05:28 PM.

  • #2
    Re: Detail view with security

    Buttons have the Security Groups Property, and while Panels don't - containers do! - so if you want you can wrap those controls you do not want visible in containers and set the Security Groups Property.
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein, (attributed)
    US (German-born) physicist (1879 - 1955)

    Comment


    • #3
      Re: Detail view with security

      Originally posted by peteconway View Post
      Buttons have the Security Groups Property, and while Panels don't - containers do! - so if you want you can wrap those controls you do not want visible in containers and set the Security Groups Property.
      Thanks for the information but I am asking that when you want to double click on a row that the detail fields don't open up. I have tried to add the containers to the detail view fields, but I do not see the security.

      I am still old fashioned and use the grids, Don't understand the UX components. Cannot get them to display in a good way.

      Thanks
      Roelof

      Comment


      • #4
        Re: Detail view with security

        Sorry can't help you. Spend some time learning the UX and make things easy for yourself.
        Insanity: doing the same thing over and over again and expecting different results.
        Albert Einstein, (attributed)
        US (German-born) physicist (1879 - 1955)

        Comment


        • #5
          Re: Detail view with security

          You don't say how you're displaying your grid detail... maybe it doesn't matter. And maybe there's a much better way of doing this... but this is kinda cool and works well.

          In your Grid Server-Side event, OnGridInitialize...

          Code:
          dim allowDetail as l
          allowDetail = Context.Security.IsCurrentUserInRole("Administrators")
          if .not. Context.Security.CallResult.Success
          	'we have a problem
          else
          	e._state.allowDetail = allowDetail
          end if
          Here we are using the new Context stuff to see if the current user is part of the group we want to allow into the Detail view. This returns .t. or .f.
          We then set that returned value into the _state variable which is available to us on the Client side.

          In the Client-Side event, onGridRenderComplete...

          Code:
          var stateInfo = {Grid.Object}.getStateInfo();
          
          var myStateInfo = stateInfo.replace(/__si2./g,'');
          myStateInfo = myStateInfo.split('&');
          
          var key, value, result;
          
          //get the state var we want
          for (key in myStateInfo) {
              if (myStateInfo.hasOwnProperty(key) && !isNaN(parseInt(key, 10))) {
                  value = myStateInfo[key];
                  if (value.substring(0, 11) === "allowDetail") {
                      result = value;
                      break;
                  }
              }
          }
          if(result != undefined){
          	var arrAllow = result.split('=');
          	var allowDetail = arrAllow[1];
                  {grid.Object}.__allowDetail = allowDetail;
          }else{
                  {grid.Object}.__allowDetail = '.f.';     
          }
          Here we get the full state var. I don't think, or know if, there is a way to get just one variable out of _state. There is in the UX... but not sure of the Grid... doesn't look like it.
          We clean up the state var a bit, split it up into an array, find the item we want, which is "allowDetail"... grab it and put it into an array... and then we have our .t. or .f. value available.
          We then assign that allowDetail value to a grid namespace variable. Just in case something goes weird assign '.f.' to the namespace just to shut everybody out.

          Finally... in the Client-Side canDetailViewOpen event...

          Code:
          if({grid.Object}.__allowDetail == '.f.'){
          	alert('Sorry... no detail for you');
          	return false;
          }
          Here we grab our grid namespace variable and check it's value. If it's '.f.' then we do not allow access to the detail view.
          Last edited by Davidk; 03-12-2016, 01:56 PM.

          Comment


          • #6
            Re: Detail view with security

            how are you opening the grid?
            if this is part of the tabbed_ui or any place. there is one other method to try.
            create one read only grid without the detail view and another read only grid with detail view
            and place two buttons controlled by security to show/hide depending on their status
            then the particular button will open proper grid based on their security. ( since the other button will not be visible it appears as though one button and the name on the button can be the same)
            thanks for reading

            gandhi

            version 11 3381 - 4096
            mysql backend
            http://www.alphawebprogramming.blogspot.com
            [email protected]
            Skype:[email protected]
            1 914 924 5171

            Comment


            • #7
              Re: Detail view with security

              Originally posted by GGandhi View Post
              how are you opening the grid?
              if this is part of the tabbed_ui or any place. there is one other method to try.
              create one read only grid without the detail view and another read only grid with detail view
              and place two buttons controlled by security to show/hide depending on their status
              then the particular button will open proper grid based on their security. ( since the other button will not be visible it appears as though one button and the name on the button can be the same)

              Nice one and it works read good, thanks.

              Comment


              • #8
                Re: Detail view with security

                You're creating 2 components... 2 components to maintain every time you need to modify something... 2 components to load into a page? Yikes.

                Double the ajax callbacks, double the sql calls, double the data being passed around. Double Yikes.
                Last edited by Davidk; 03-12-2016, 10:04 PM.

                Comment


                • #9
                  Re: Detail view with security

                  David,

                  Thanks for sharing that info on the new context stuff. I don't really use grids anymore but if I ever needed to I can see where that'd come in handy. I'm sure it will have its uses in the ux as well.

                  I know Gandhi's method keeps you within your comfort zone but David's method is slick and efficient. Why have two components where you only need one. I'd recommend doing as much work as you can client side as it really makes a difference when your user base becomes larger and the application larger. Take as much load off of the web server as you can.

                  Comment


                  • #10
                    Re: Detail view with security

                    On the other hand if you put two components on the page and that is a performance bottleneck then the word component is misleading.

                    Comment


                    • #11
                      Re: Detail view with security

                      i am not sure why it is difficult with two components
                      1> to create two components you do not need to work hard. create a single grid with detail view and save that as grid_with_detail_view then uncheck the has detail view check box and save that as grid_without_detail_view. at anytime go back recheck the same box all of the detail view should come back without any problems or you can edit the grid_with_detail_view and save as before into two components.
                      2> i don't think the page has both those two components at anytime. when the button security is enabled the alpha server validates the user and makes that button property visible or not before sending it to the browser. button click then calls the server to fetch the component, components are not sent along with the tabbedui - to test this load the tabbedui then turn off the internet and call for a component and it will not fetch the component. turn internet back on, all will be good.
                      3> in addition there is template manipulation it should be possible to show or hold detail view if you are against two component approach with
                      Code:
                      if Context.Security.IsCurrentUserInRole("Administrators") then
                      tmpl.detailview.has_detailview = .f.
                      end if
                      i cannot test context.security function. it is not available in version 11, i will test with the available security function to see this is possible.
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      [email protected]
                      Skype:[email protected]
                      1 914 924 5171

                      Comment


                      • #12
                        Re: Detail view with security

                        here is a simple screencast to show you that in version 11 it takes 5 lines of code to show or hide detail view on demand

                        http://screencast.com/t/U5KaTzVheq

                        hope this helps.
                        this will require only one event (grid execute as opposed to grid initialize which only fires once) which fires on every execution of the grid.
                        no server side event ( grid initialize will not fire after an ajaxcallback or re-execution of the grid making the client side events worthless) followed by client side event then followed by yet another client side event. 5 lines of code versus many lines of code.
                        Last edited by GGandhi; 03-14-2016, 08:36 AM.
                        thanks for reading

                        gandhi

                        version 11 3381 - 4096
                        mysql backend
                        http://www.alphawebprogramming.blogspot.com
                        [email protected]
                        Skype:[email protected]
                        1 914 924 5171

                        Comment


                        • #13
                          Re: Detail view with security

                          Originally posted by GGandhi View Post
                          i am not sure why it is difficult with two components
                          It's not difficult... it's wrong.

                          Comment


                          • #14
                            Re: Detail view with security

                            Originally posted by Davidk View Post
                            It's not difficult... it's wrong.
                            It's not wrong...

                            Comment


                            • #15
                              Re: Detail view with security

                              Originally posted by Davidk View Post
                              It's not difficult... it's wrong.
                              why?
                              can you explain?
                              thanks for reading

                              gandhi

                              version 11 3381 - 4096
                              mysql backend
                              http://www.alphawebprogramming.blogspot.com
                              [email protected]
                              Skype:[email protected]
                              1 914 924 5171

                              Comment

                              Working...
                              X