Sm_PolicyApi_GetUserContext()
Allows callers of the Policy Management API to access user context information.
casso126
Allows callers of the Policy Management API to access user context information.
Type
User directory function, global scope.
Syntax
int SM_EXTERN Sm_PolicyApi_GetUserContext (void*pSessionHandle,const char*lpszUserDirOid,const char*lpszUserPath,const char*lpszSessionID,Sm_PolicyApi_UserContext_t**ppPolicyApiUserContext););
Parameter | I/O | Description |
pSessionHandle
| I | A pointer to an internal Policy Management API data structure. The structure holds information about the administrator session and the client session. |
lpszUserDirOid
| I | A null-terminated string containing the object identifier of the user directory for the user specified in lpszUserPath . |
lpszUserPath
| I | The distinguished name of the user. |
lpszSessionID | I | A unique identifier of the session. After a successful login, the session ID is returned in the lpszSessionId field of the structure Sm_AgentApi_Session_t.If the session ID is not known, assign an empty string ("") to this parameter. |
ppPolicyApiUserContext | O | The user context information that CA Single Sign-On passes to the function. |
Remarks
This function allows an application to access information about a user without having to connect to the underlying user directory. To retrieve the user information, the application calls the functions in the Sm_Api_UserContext_t structure, which is returned in ppPolicyApiUserContext.For example:
- Calling fGetProp or fSetProp to get or set a user attribute.
- Calling fAuthenticate to verify a user's password.
- Calling fGetProp to search the directory and examine the results to verify that the correct user has been found.
- Calling fGetProp to retrieve an attribute for a user who is not the logged-in user.
After calling Sm_GetUserContext(), release the allocated memory by calling Sm_PolicyApi_FreeMemoryEx(). Otherwise, you can possibly see some Policy Server performance degradation.
Returns
- Sm_PolicyApi_Success. The get operation was successful.
- Sm_PolicyApi_Failure. The get operation was not successful.
- Sm_PolicyApi_NoSession. There is no valid administrator session.
- Sm_PolicyApi_Invalid. The specified user or directory was not valid.
- Sm_PolicyApi_InvalidHandle. There was no valid initialization prior to this call.
- Sm_PolicyApi_NoPrivilege. The administrator does not have the privilege to get a user directory.