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

set a list control component 'control' to read-only based on a security setting ...

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

    set a list control component 'control' to read-only based on a security setting ...

    Can this be done in, say, four relatively simple steps?

    #2
    Re: set a list control component 'control' to read-only based on a security setting ...

    one way, from a non version 12 user:
    1>create two list controls displaying same information with one read only property another normal list control,
    2>blanket each control in containers
    3> show hide each container based on the security.

    there you go 3 simple steps.
    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


      #3
      Re: set a list control component 'control' to read-only based on a security setting ...

      Thanks Gandhi for your reply - yours is a simple and clever strategy for a normal UX component, but for a list component I can't see how to bind the duplicate text control to values in the list. Is it then possible to bind two controls on the UX to one value in the list control?

      Comment


        #4
        Re: set a list control component 'control' to read-only based on a security setting ...

        can you not have list1 bound to some data and list2 bound to the same data. ux cannot complain.
        and to make look same you just have to change the label to be the same. so when you show hide the list does not look different to the user.
        Last edited by GGandhi; 01-14-2016, 02:42 PM.
        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


          #5
          Re: set a list control component 'control' to read-only based on a security setting ...

          Originally posted by Malcolm View Post
          Can this be done in, say, four relatively simple steps?
          Malcom,

          What is your use case? The List control is, essentially, read-only. Unless you're using a Detail View or some other method of changing it's data. It is a non-editable control when used as just a List. What is it you'd like to do?

          Comment


            #6
            Re: set a list control component 'control' to read-only based on a security setting ...

            I have a component with two list controls each with a detail view, and another panel. One of the controls in the detail view I'd like to be read-only for users in one security group, but editable for users in another two groups. This control is bound to the 'AppraisersComment' SQL field - hence the users can't comment - but should see the field.

            I have tried arranging two text controls in the detail view, one read-only (using the checkbox in the control property) and one not - but I can't get them both bound to the same field. This applies with each control in a separate container as well. This situation would appear to be logical in normal circumstances (to prevent different data being pushed by two controls to a single field), but with one control 'read-only' I'd hoped it might be permissible. Unfortunately not.

            Gandhi's solution looked great, to duplicate the whole list control and detail view (with a number of headers/footers etc) and place each copy in a separate container with the component security set appropriately in each. However, my understanding is that I'd need a Panel Layout to enclose the two new containers (I can't have a container nested directly inside the Navigator). My experience is that Panel Layouts result in problems with the PanelSetActive function in the button that currently sets another panel as active from within the List detail.

            This is getting complicated, and I've tried to upload a grab from the new 'structure Explorer' to give an idea of the component, but it currently won't accept a JPG of 22kb! Hopefully I'll get it organised soon.
            Last edited by Malcolm; 01-15-2016, 04:00 AM.

            Comment


              #7
              Re: set a list control component 'control' to read-only based on a security setting ...

              I'd prefer to keep things a bit simpler and not have to duplicate anything. What you want to do is essentially assign the AppraisersComment control a security role, or roles, that is valid. If a user logs in and belongs to that role then all is good. If a user logs in that is not part of that role then the control is read-only. This process follows a video Selwyn created about setting security on controls client-side. Have a look in the Release Notes for "Applying Security Client-Side". Here are the highlights.

              I've got this code in the Server-side onLogin event. It gets the User Roles and sends them through to the client in a namespace variable.

              Code:
              dim roles as c
              roles = Context.Security.GetUserRoles()
              
              dim js as c
              js = "{dialog.object}._roles = " + js_list_to_array(roles) + ";"
              
              e.javascript = js
              On the Detail View control you want to secure... in the Client Side Properties, Readonly Expression... we are calling a Javascript function named inRole which passes through the role we say is ok for editing this field. If more than one role is allowed, then it's just a common delimited list... e.g. 'Administrators,Participants'. If this function returns true the control is read-only... if it returns false the control is editable.

              Code:
              inRole('Administrators')
              The Javascript function is...

              Code:
              function inRole(roles){
              
              	var _userRoles = {dialog.object}._roles;
              	if(typeof _userRoles == 'undefined') return true;
              	
              	var _allowedRoles = roles.split(',');
              	
              	var flag = true;
              	for(var i = 0; i < _allowedRoles.length; i++){
              		if(_userRoles.indexOf(_allowedRoles[i]) > -1) {
              			flag = false;
              			break;
              		}
              	}
              	return flag;
              
              }
              Here we grab the namespace variable containing all the roles this user belongs to... and we've passed in the role or roles that we approve.

              We set a default return value of true because no matter what, we want to set this control read-only.

              We loop through the list of allowed roles matching against user roles. If we find a match then we return false... which means the control is open for edit.

              Comment


                #8
                Re: set a list control component 'control' to read-only based on a security setting ...

                Thanks David, that looks a bit of a stretch for me at the moment, but you've given me a good start. Thanks again. Malcolm

                Comment


                  #9
                  Re: set a list control component 'control' to read-only based on a security setting ...

                  i still want to ask a question which is not clear to me, even though i do not use version 12.
                  if one creates a list1 without checking the checkbox, has detail view, then it will be just read only. the detail view never will show up.
                  and then creates another list2 using the same data but now check the has detail view checkbox and fill in all the necessary data - it will be now editable.
                  envelope each list in a container and make them show/hide based on the security
                  the person with read only will never see the detail part whether it is made editable or not, he has no business seeing it. and the person who can edit will see and be able to edit.
                  is that impression, i have, correct?
                  regardless one does not want to duplicate any control or not, it is their decision.
                  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


                    #10
                    Re: set a list control component 'control' to read-only based on a security setting ...

                    Gandhi,

                    there are other controls on the detail screen that users can edit, regardless of security. But you are right in saying that the list control itself is a readonly entity.

                    So, in the case above, you would be duplicating the list and detail views simply for the sake of making a single control read only.

                    Furthermore - though it is not mentioned above, these are dependent lists. So the first list is a parent list of the second list - so duplicating the lists becomes even more complex in this scenario.

                    Comment


                      #11
                      Re: set a list control component 'control' to read-only based on a security setting ...

                      i understand the extent of the list control. in my opinion, it is only a read only grid with optional detail view in a new name to be used with dialog/ux.
                      the way i understood the question, which is open to correction by malcolm, is that he needed list read only or editable based on security in four single steps. no mention about lists based on lists, part of detail view being editable etc.,
                      so i am tuned in one direction. but thanks for explaining the capacity of lists as such. it is still fitting my impression what list is.
                      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: set a list control component 'control' to read-only based on a security setting ...

                        Your impression of lists is pretty accurate - although they have other features beyond what grids can do.

                        For instance, they have the ability to shrink and expand based on flex fields - so they are much better for mobile programming than grids.

                        But there is only one control that needs read only status -

                        One of the controls in the detail view I'd like to be read-only for users in one security group, but editable for users in another two groups. This control is bound to the 'AppraisersComment' SQL field - hence the users can't comment - but should see the field.

                        Comment


                          #13
                          Re: set a list control component 'control' to read-only based on a security setting ...

                          One of the controls in the detail view I'd like to be read-only for users in one security group, but editable for users in another two groups. This control is bound to the 'AppraisersComment' SQL field - hence the users can't comment - but should see the field.
                          that was not in the first post,
                          if that's the case then it would be easy to have one list with detail view and that control alone in the detail view enabled/disabled based on security will all that is necessary, I would think.
                          no need for two lists, no need for javascript enabling detail view read only or editable. I would think.
                          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


                            #14
                            Re: set a list control component 'control' to read-only based on a security setting ...

                            Originally posted by GGandhi View Post
                            i still want to ask a question which is not clear to me, even though i do not use version 12.
                            if one creates a list1 without checking the checkbox, has detail view, then it will be just read only. the detail view never will show up.
                            and then creates another list2 using the same data but now check the has detail view checkbox and fill in all the necessary data - it will be now editable.
                            envelope each list in a container and make them show/hide based on the security
                            the person with read only will never see the detail part whether it is made editable or not, he has no business seeing it. and the person who can edit will see and be able to edit.
                            is that impression, i have, correct?
                            regardless one does not want to duplicate any control or not, it is their decision.
                            As I pointed out in post #5, the List control, without a Detail View is, essentially, read-only.

                            Malcolm asked for a read-only Detail View control... not show/hide. The security functionality at the control level of a UX is Server-side show/hide. The point is that Malcolm what's all users to see the control and only some to have edit rights. Show/hide will not accomplish this.

                            It may be the user's decision to duplicate a full List control... the user can implement whatever bad practices they want... and then they'd get to deal with an over-bloated component in which a single change to a List control means changes to 2 List controls.

                            I'd prefer to implement 19 lines of code to duplicating a List control and then having to live with a bad decision that didn't give me what I wanted in the first place.

                            Comment


                              #15
                              Re: set a list control component 'control' to read-only based on a security setting ...

                              Originally posted by GGandhi View Post
                              that was not in the first post,
                              if that's the case then it would be easy to have one list with detail view and that control alone in the detail view enabled/disabled based on security will all that is necessary, I would think.
                              no need for two lists, no need for javascript enabling detail view read only or editable. I would think.
                              Could you post your solution for "enabled/disabled based on security"?

                              Comment

                              Working...
                              X