API to access to user profile

This javascript function returns the properties of the connection data in a list of elements (below). It is called with the ASYRWEBSER.EXEC_JS function.

Definition

ModuleFunction namemodeCALLB value
syracuse-4gl-api/lib/collaborationgetUserProfilewait0

Result returned

The result is a complex JSON structure that contains technical information subject to change. Some sub-structures can be used as well.

element / Sub-elementsDescription
"selectedRole"
"selectedRole.code"
"selectedRole.description"
"selectedRole.groups"
"selectedRole.groups[N].description"
"selectedRole.badges"
"selectedRole.badges[N].code"
"selectedRole.securityProfile.description"
The current role structure:
- the associated code
- the description of the role
- the list of groups the role that have the same role
- the description of the (N+1)th group in the list
- the list of badges the role has access to
- the code of the (N+1)th badge the role has access to
- the description of the security profile associated to the role
"selectedEndpoint"
"selectedEndpoint.code"
"selectedEndpoint.application"
"selectedEndpoint.contract"
"selectedEndpoint.x3ServerFolder"
"selectedEndpoint.x3SolutionName"
The current endpoint structure:
- the associated code
- the application code for the endpoint
- the contract code for the endpoint
- the server folder code associated to the endpoint
- the solution name for the endpoint
"selectedLocale"
"selectedLocale.code"
"selectedLocale.firstDayOfWeek"
"selectedLocale.numberDecimalSeparator"
"selectedLocale.numberGroupSeparator"
"selectedLocale.numberGroupSize"
"selectedLocale.twoDigitYearMax"
The current locale structure:
- the corresponding code
- the first day of the week (0=Monday, 1=Tuesday...)
- the decimal separator used for numbers
- the separator used between groups of digit on big numbers
- the number of digits in the groups (usually 3)
- the maximum value for a two year on two digit, that defines the range of the date when expressed on 2 digits. For instance, 2029 gives a range from 1930 (30) to 2029 (29).
"user"
"user.login"
"user.title"
"user.firstName"
"user.lastName"
"user.email"
"user.groups"
"user.groups[N].description"
The current login user structure:
- the corresponding login code
- the title of the user
- the first name of the user
- the last name of the user
- the email address of the user
- the list of groups the user is member of
- the description of the (N+1)th group

Example

This is an example of a function that returns the connected user's current role code. Note that the role can be changed without notification to the server. It is therefore necessary to call this function every time the current role is needed.

### A function that returns the current role codeFunprog GET_ROLE_DESCRLocal Clbfile RESHEADLocal Clbfile RESBODYLocal Integer STATUSCODE### Module, function and element to be returnedLocal Char MODULE(100) : MODULE = 'syracuse-4gl-api/lib/collaboration'Local Char FONCTION(30) : FONCTION = 'getUserProfile'Local Char RETURNS(50) : RETURNS = "selectedRole.code"### The function is asynchronousLocal Char MODE(4) : MODE = 'wait'### The callback argument is located in the first place for this functionLocal Integer CALLB : CALLB=0### No Base 64 in or out coding, the arguments can remain emptyLocal Char B64_IN(20), B64_OUT(20)### No additional argumentsLocal Clbfile ARGUMENTS : ARGUMENTS = ""# Let's call the functionSTATUSCODE = func ASYRWEBSER.EXEC_JS(MODULE, FONCTION, MODE, ARGUMENTS, B64_IN, CALLB, RETURNS, B64_OUT, RESHEAD, RESBODY)# If the call fails, return an empty codeIf STATUSCODE<>200 : End "" : EndifEnd RESBODY