CRecordUserDbGetUserList
Fetches a list of all registered users.
    This message belongs to the Session Manager API.
    The Session Manager is part of the NY_Session2PlugIn plugin.
{
  "id": "7921c886-3d67-41a6-b451-b091b3ae092a",
  "name": "USER_DB_GET_USER_LIST ",
  "description": "Get the user list.",
  "slots": [
    {
      "key": "1",
      "name": "USER_IDS",
      "direction": "ANSWER",
      "mandatory": "true",
      "type": "STRING_ARRAY",
      "description": "An array of user ids."
    }
  ]
}
Usage
Sending the request
You need the microservice ID of the session manager:
public static final IIdSESSION_MICROSERVICE_ID = CIdFactory.fromObject("ccf168c1-f18b-4229-85f9-24461a19ee6a");
    To fetch the user list, we need the token we received when we logged in.
    We additionally need the corresponding right to fetch the user list: NY_GetUserList.
    User rights are stored in the user database by the administrator.
private void getUserList(final byte[] aToken) throws CException { final CEnvelope env = CEnvelope.forMicroService(SESSION_MICROSERVICE_ID ); env.setSessionToken(aToken); final CRecord record =CRecordUserDbGetUserList .create(); sendRequest(env, record); }
Dealing with the response
To catch the response of the request, we need a message handler. We add it in the constructor of the message handler registry.
// constructor: addMessageHandler(CRecordUserDbGetUserList .ID, this::asyncGetUserList );
private booleanasyncGetUserList (@NotNull final CEnvelope aEnvelope, @NotNull final CRecord aRecord) { if (aEnvelope.isAnswer()) { final int resultCode = aEnvelope.getResultCode(); if (resultCode == CResultCode.SUCCESS) { final byte[] token = env.getSessionToken(); final String[] userIds =CRecordUserDbGetUserList .getUserIds(aRecord, null); // ... } return true; } return false; }
