- if (rc != 200 && rc != 404) {
- client.setStatus(DmaapObject_Status.INVALID);
- revokePermsError(err, rc, dmaapService.getTopicPerm(), instance, action, client.getClientRole());
+ private void grantPermForClientRole(String clientRole, String instance, String action) throws PermissionServiceException {
+ if (clientRole != null) {
+ DmaapPerm perm = new DmaapPerm(dmaapService.getTopicPerm(), instance, action);
+ DmaapGrant g = new DmaapGrant(perm, clientRole);
+ int code = aafService.addGrant(g);
+ if (code != 201 && code != 409) {
+ throw new PermissionServiceException(code, format("Grant of %s|%s|%s failed for %s",
+ dmaapService.getTopicPerm(), instance, action, clientRole));