A5WS_Get_WebUser_Values Function
Syntax
Arguments
- Result
The result value is not meaningful if the function is being used in a web component.
- result.errors = Will return TRUE if any errors are found during processing.
- result.error_text = Error messages returned.
- CurrentForm
The CurrentForm variable.
- UserValue
Optional. A pointer variable used to pass user defined values to the function. These will override the same values passed by the Request system variable. Users can be found by three possible values passed in the variable. They are checked in sequence until a match is found. If no UserValue variables are specified, the function will use the values passed by the Request system variable.
- UserValue.guid = The user GUID value for the desired user record
- UserValue.userid = The 'userid' value for the desired user record
- userValue.ulink = The 'ulink' value saved in the desired user record
- LocalRequest
Optional. The Request system variable. The request variable should be considered READ ONLY. It is added automatically by the server when run from a web page. Users may be found by
- request.variables.guid = The user GUID value for the desired user record
- request.variables.userid = The 'userid' value for the desired user record
- request.variables.ulink = The 'ulink' value saved in the desired user record
Description
Return values from web user table as 'CurrentForm.Controls.<fieldname>.value' for each field in table. 'UserValue' overrides values passed by the request system variable. Accepts user identification as 'UserValue.guid','UserValue.userid' or 'UserValue.ulink'.
Discussion
The A5WS_Get_WebUser_Values() function populates control values in a dialog component from fields in the User table. The function returns values from web user table as CurrentForm.Controls..value for each field in table. Accepts user identification as UserValue.guid, UserValue.userid or UserValue.ulink. If the UserValue variable is empty or not supplied, the function will use the same values passed by the system request variable. The name of each control in the dialog must exactly match the name of the field in the user table. A list of valid field names can be found by using the A5WS_User_File_Field_List() function. Typically used in the Server Initialize event of a dialog component. You can also use this function in the Server After Validate event to repopulate values after a save. Adding Users with a Web Component shows how the function is used in dialog component events.
- 1. Display the Form > Properties menu page of the Dialog Builder.
- 2. Click in the Server Events > Initialize property.
Example
a5ws_get_webuser_values(CurrentForm)
Using the Function Outside of a Dialog Component
put description here
The function is designed to be used within Server Events of a dialog component. However, it can be used on any Xbasic code section on a web page or component to return various values for a specific user. It is helpful to get a list of valid field names currently being used in the user security table by using the A5WS_User_File_Field_List() function. One additional field named groups can be returned. It will contain a comma delimited list of the security groups assigned to the user. The group values returned will be the group_guid value for each group, not the group names. A list of group names assigned to the user can be found using the function A5WS_Get_User_Assignments.
?a5ws_User_File_Field_List() = Email Guid Password Ulink Userid
The fields to be output from the function must be defined. The function will only return values for field names passed to the function as .Controls..value and will only return values for fields currently being used by the security system.
dim output as p dim output.controls as p dim output.controls.email.value as c dim output.controls.userid.value as c dim output.controls.groups.value as c dim output.controls.guid.value as c
A value must be passed to the function in the Request system variable to find the current user. This can be in the form request.variables.guid, request.variables.userid or request.variables.ulink.
dim UserValue as p dim UserValue.ulink as c UserValue.ulink = "00000008"
The function will return the values found in the output.controls..value. The result.errors value can be tested to determine if any errors occured during processing. Any error messages will be should in the result.error_text value. The userid value can be used to get a list of group names for the user using the function A5WS_Get_User_Assignments.
dim result as p dim error_message as c dim group_list as c result = a5ws_Get_WebUser_Values(output,UserValue) if result.errors = .T. then error_message = result.error_text end end if group_list = a5ws_get_user_assignments(output.controls.userid.value,request) group_list = crlf_to_comma(group_list)
Limitations
May only be used in a web component or web page.
See Also