CRecordUserDbGetRightRecord
Get a right description from the user database.
    This message belongs to the Session Manager API.
    The Session Manager is part of the NY_Session2PlugIn plugin.
{
  "id": "109e5fb5-6a8b-44c9-b706-b59779f09d27",
  "name": "USER_DB_GET_RIGHT_RECORD ",
  "description": "Get a right record.",
  "slots": [
    {
      "key": "1",
      "name": "RIGHT_ID",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "STRING",
      "description": "The right id."
    },
    {
      "key": "10",
      "name": "DESCRIPTION",
      "direction": "ANSWER",
      "mandatory": "false",
      "type": "STRING",
      "description": "The right description."
    }
  ]
}
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 data of a user right, we need the right ID.
    Additionally, we need the session token of the current user to check the right to this request.
    The executing user needs the NY_GetRightData permission.
    User rights are stored in the user database by the administrator.
private void getRightRecord(final byte[] aToken,
                            @NotNull final String aRightId) throws CException
{
    final CEnvelope env = CEnvelope.forMicroService(SESSION_MICROSERVICE_ID );
    env.setSessionToken(aToken);
    final CRecord record = CRecordUserDbGetRightRecord .create();
    CRecordUserDbGetRightRecord .setRightId(record,
                                           aRightId);
    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(CRecordUserDbGetRightRecord .ID, this::asyncGetRightRecord );
private booleanasyncGetRightRecord (@NotNull final CEnvelope aEnvelope, @NotNull final CRecord aRecord) { if (aEnvelope.isAnswer()) { final int resultCode = aEnvelope.getResultCode(); if (resultCode == CResultCode.SUCCESS) { final String id =CRecordUserDbGetRightRecord .getRightId(aRecord, null); final String description =CRecordUserDbGetRightRecord .getDescription(aRecord, null); // ... } return true; } return false; }
