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

adding an additional security group to a user

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

    adding an additional security group to a user

    Trying to add a additional security group to an existing user in a UX. The demo components are geared towards retrieving the available security groups and then choosing between them with a radio button, or choosing multiple groups with a check box control.

    I do not need to retrieve all the groups, but only want to identify the user, and then add them to a additional security group (this will not be visible to the user).

    ExecuteServerSideAction("Load Web Security Values::LoadSecurity") gives me all the groups. TMI!

    I have the user name in a session variable so I am thinking that I can just identify the record with the user name, and then add a group in a server side action , or actions.

    I did create a work around by populating a second control with the retrieved groups, and then using a textbox control to fill the UserRoles control with name of the desired group. This however changed the group rather than adding a second group. Would like to understand the proper way to do this.

    I suspect that you cannot use action scripting to do this and you must use the web security funtion A5WS_Save_WebUser_Values()
    There is no complete example of this that I can find.

    Thanks,
    Bob
    Last edited by bob9145; 02-03-2016, 11:54 PM.

    #2
    Re: adding an additional security group to a user

    A good example of a script in a UX that retrieves the logged in user with an existing group assignment, and adds a second group assignment problematically without using action scripting. Examining the xbasic of the action scripting for editing security values is like playing solitaire with 50 cards. it ain't all there. Understandably so: but you shouldn't need a month of Wednesdays, and a Rosetta stone to problematically manipulate a users assigned security group.

    Comment


      #3
      Re: adding an additional security group to a user

      One obvious question the groups are returned as a comma delimited list that you can only get to in a control that can grab the variable that they are contained in. How can I get to this variable without using a control?

      Comment


        #4
        Re: adding an additional security group to a user

        I searched near, and far, and found only the documentation for A5WS_Save_WebUser_Values() at http://wiki.alphasoftware.com/A5WS_S...alues+Function
        This doesn't give a working example, and is vague.

        Tried modifying the UX edit user template to accomplish this but can't find a work around. Seems a radio button, or check box is the only way to use the template, neither accomplish my purpose of adding a group assignment to an existing user programmatically.

        Help! Uncle!

        Comment


          #5
          Re: adding an additional security group to a user

          Yep, I hope Alpha straightens out that action scripting Web Security mess very soon, especially for us wanting to go to IIS! I mean, they put a lot of effort into setting up action scripting, but they have ignored giving us a nice set of functions for manipulating the security tables outside of action scripting. For example, Alpha offers this function:

          Group_List as C = A5WS_Get_User_Assignments( User as C [, Request as P ] )

          It is a pretty good function except, where is the counterpart function to write change data back to the user assignment security table and what exactly does it need from the "Request" variable!?

          I've moved my Web Security tables to the SQL database that contains the tables for my project. If needed, I can manipulate the security tables directly and not worry about trying to go through Alpha's functions. However, getting the web security tables over to SQL was not easy - it was far too time consuming as the web security table publishing functions are too muddled up.

          If your security tables are still in DBF maybe you can just access them through DBF file commands and manipulate them directly.

          Comment


            #6
            Re: adding an additional security group to a user

            Thank you Rich, if I move them to my darabase I would assume they are not as secure. Can an Alpha top gun weigh in on this?

            Comment


              #7
              Re: adding an additional security group to a user

              Something like this for the web side would be nice
              http://wiki.alphasoftware.com/A5_ASS...ROUPS+Function

              Comment


                #8
                Re: adding an additional security group to a user

                This effort to manipulate checkboxes was in order to manipulate security groups dynamically for a user in my app.
                I started with the UX security template to edit a user, and tried to get to the userroles control to accomplish this programatically.

                {dialog.Object}.setValue('CHECKBOXES[]',['checkbox1','checkbox2']); worked on a checkbox control with a static list, however it did not work in the template with the checkbox being populated by security groups and set as checked according to the current users group assignment. Well it did create some erratic behavior it cleared the check mark of any checked groups.


                Since the template uses action scripting it has been difficult to understand. I did manage a work around however. Once I understood how to use setValue with a checkbox array.

                I manually populated the control choices with e.rtc.UserRoles = comma_to_crlf("group1,group2") vs a5ws_GetGroupsDialog()
                This populated the control choices variable UserRoles with the specific groups I needed.

                I converted the ondialoginitialize ExecuteServerSideAction("Populate Dialog from Tables::LoadUser") to xbasic

                I then removed:

                groups=[UserRoles] from the rtc.fieldmap. So although group1, and group2 are checkbox chioces populated with the UserRoles variable they are not selected,although in this scenario group one would have been checked when populated by the template because these users are all assigned to group1.

                I then put {dialog.Object}.setValue('UserRoles[]',['group1','group2']); in a on focus event of another textbox field in the control group that I know will be populated by the user. This checks the two boxes.

                Why two groups? I already know that these users are a member of group1, and need to be added to group2. However validating and saving the security groups clears any existing assignments in security. I am not sure exactly why this is because I do not know how to expose, or am not recognizing the code that handles this. So again as a work around I just reassign both groups.

                Now last problem, I need this to be invisible to the user. However I can't make the control hidden as far as I know because that only applies to a textbox field. So I just hide the row, and the label.

                This works but doesn't seem secure to me at all. This is the work of a challenged, but determined programmer!
                I would like to understand this fully, since it is a frequent requirement of my app.

                for now it works
                Second group assigned: Check!

                Bob

                Comment


                  #9
                  Re: adding an additional security group to a user

                  Bob, you talked about having trouble with hidden checkbox control. In my UX I created four checkbox controls for holding four of the basic default user group assignments that I wanted in my app. I put four corresponding push buttons on the UX with inline javascript to copy the values from the corresponding checkbox control to the main control for the user group assignments. By default, I didn't want the app admin to be bothered seeing these default checkbox controls. So, I put them on tab panes and then I put the entire tab in a Container with SubType set to "Window" and Window Type set to "Modal Popup". This way my source checkbox controls are not visible unless the user clicks the Help button that I have put on the UX. The help button uses ActionJavascript to show that container window. The code for copying the values from one of the default checkbox controls ('HDN_DEF_EMP') to the main control ('SECGRPS') looks like this::

                  Code:
                  // AA workaround - force ux dirty so GetValue will use values from control, not from "originalValues"
                  {dialog.Object}.setValue('SECGRPS', 'b81c47622bee4dc1b50d3a35f65ce69c');
                  {dialog.Object}.setValueFrom('SECGRPS','HDN_DEF_EMP');
                  (Notice the second line above, ".setValue('SECGRPS',...), replace the 2nd parameter guid with a GUID from your security group table or find some other way to make the destination checkbox control dirty! Argh, I hate all the workarounds I have to do for AA)

                  I populate the four default checkbox controls by setting an e.rtc variable in the onDialogInitialize event like this:

                  Code:
                  	rtnFld = "sgFriendly_Name + '|' + Group_Guid"
                  	e.rtc.DefEmp = sql_get_values(cn,tbl,fltr,rtnFld,.t.)
                  My security Groups are in SQL, so I have added some extra columns to the table: 1) a "Friendly Name" column, 2) a User Type column, 3) an onscreen Help Text column.
                  The "User Type" column is a comma delimited list of user types that, by my choice, should have that particular security group.

                  Now, the really buggy part of all this is getting all the checkboxes automatically check-marked in my four default checkbox controls. AA has a limitation on how many checkbox values can be initialized in the "onDialogInitialize" event using the "e.control.checkboxXX = " syntax. Sometime after build 12.3 ver 2689, alpha seems to have fixed some or maybe all the issues related to using the "e.control." method to set defaults. I have to stick to what can be used in production environment. So, I set the default checkboxes by coding the javascript initialization code myself using the onscreen notes for that embed. That code looks like this:

                  Code:
                  	'-- Cannot use e.control. syntax to set initial checkmarks, Alpha has some limit on number or size
                  	'-- Must generate the JS directly
                  	dim js as c
                  	js = <<%txt%
                  	var _d = {};
                  	$u.o.assign(_d,{dialog.object}.originalValues[0]);
                  	_d['HDN_DEF_EMP'] = _VAL_CHK_EMP_ ;
                  	_d['HDN_DEF_EVAL'] = _VAL_CHK_EVAL_ ;
                  	_d['HDN_DEF_SUPV'] = _VAL_CHK_SUPV_ ;
                  	_d['HDN_DEF_AA'] = _VAL_CHK_AA_ ;
                  	{dialog.object}.prepare();
                  	{dialog.object}.populate(_d);
                  	{dialog.object}.refreshClientSideComputations();
                  	%txt%	
                  	dim tmp as c
                  	dim tmp2 as C
                  	tmp = *for_each(ID, quote(word(ID, 2, "|"),"'"),e.rtc.DefEmp)
                  	tmp2 = "[" + CRLF_TO_COMMA(tmp) + "]"	
                  	js = STRTRAN( js, "_VAL_CHK_EMP_", tmp2, 1, 1 )
                  	
                  	tmp = *for_each(ID, quote(word(ID, 2, "|"),"'"),e.rtc.DefEval)
                  	tmp2 = "[" + CRLF_TO_COMMA(tmp) + "]"	
                  	js = STRTRAN( js, "_VAL_CHK_EVAL_", tmp2, 1, 1 )
                  
                  	tmp = *for_each(ID, quote(word(ID, 2, "|"),"'"),e.rtc.DefSupv)
                  	tmp2 = "[" + CRLF_TO_COMMA(tmp) + "]"	
                  	js = STRTRAN( js, "_VAL_CHK_SUPV_", tmp2, 1, 1 )
                  
                  	tmp = *for_each(ID, quote(word(ID, 2, "|"),"'"),e.rtc.DefAA)
                  	tmp2 = "[" + CRLF_TO_COMMA(tmp) + "]"	
                  	js = STRTRAN( js, "_VAL_CHK_AA_", tmp2, 1, 1 )
                  	
                  	e.javascript = js
                  I suppose the default checkboxes could also be turned on using client-side code after the dialog is initialized, but I prefer having it set from the server side.

                  Comment


                    #10
                    Re: adding an additional security group to a user

                    Thank you Rich, I will look it over.

                    Comment

                    Working...
                    X