ARTEMIS-3923 AddressControlImpl.getRoles doesn't return all the security role permissions.

* Adding the missing permissions to the array.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
This commit is contained in:
Emmanuel Hugonnet 2022-08-08 09:31:25 +02:00 committed by Bruscino Domenico Francesco
parent 382267bf63
commit 7fe3e5d198
2 changed files with 25 additions and 8 deletions

View File

@ -211,7 +211,19 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
int i = 0;
for (Role role : roles) {
objRoles[i++] = new Object[]{role.getName(), CheckType.SEND.hasRole(role), CheckType.CONSUME.hasRole(role), CheckType.CREATE_DURABLE_QUEUE.hasRole(role), CheckType.DELETE_DURABLE_QUEUE.hasRole(role), CheckType.CREATE_NON_DURABLE_QUEUE.hasRole(role), CheckType.DELETE_NON_DURABLE_QUEUE.hasRole(role), CheckType.MANAGE.hasRole(role)};
objRoles[i++] = new Object[]{
role.getName(),
CheckType.SEND.hasRole(role),
CheckType.CONSUME.hasRole(role),
CheckType.CREATE_DURABLE_QUEUE.hasRole(role),
CheckType.DELETE_DURABLE_QUEUE.hasRole(role),
CheckType.CREATE_NON_DURABLE_QUEUE.hasRole(role),
CheckType.DELETE_NON_DURABLE_QUEUE.hasRole(role),
CheckType.MANAGE.hasRole(role),
CheckType.BROWSE.hasRole(role),
CheckType.CREATE_ADDRESS.hasRole(role),
CheckType.DELETE_ADDRESS.hasRole(role)
};
}
return objRoles;
} finally {

View File

@ -240,13 +240,18 @@ public class AddressControlTest extends ManagementTestBase {
Assert.assertEquals(1, roles.length);
Object[] r = (Object[]) roles[0];
Assert.assertEquals(role.getName(), r[0]);
Assert.assertEquals(CheckType.SEND.hasRole(role), r[1]);
Assert.assertEquals(CheckType.CONSUME.hasRole(role), r[2]);
Assert.assertEquals(CheckType.CREATE_DURABLE_QUEUE.hasRole(role), r[3]);
Assert.assertEquals(CheckType.DELETE_DURABLE_QUEUE.hasRole(role), r[4]);
Assert.assertEquals(CheckType.CREATE_NON_DURABLE_QUEUE.hasRole(role), r[5]);
Assert.assertEquals(CheckType.DELETE_NON_DURABLE_QUEUE.hasRole(role), r[6]);
Assert.assertEquals(CheckType.MANAGE.hasRole(role), r[7]);
Assert.assertEquals(CheckType.SEND.hasRole(role), (boolean)r[1]);
Assert.assertEquals(CheckType.CONSUME.hasRole(role), (boolean)r[2]);
Assert.assertEquals(CheckType.CREATE_DURABLE_QUEUE.hasRole(role), (boolean)r[3]);
Assert.assertEquals(CheckType.DELETE_DURABLE_QUEUE.hasRole(role), (boolean)r[4]);
Assert.assertEquals(CheckType.CREATE_NON_DURABLE_QUEUE.hasRole(role), (boolean)r[5]);
Assert.assertEquals(CheckType.DELETE_NON_DURABLE_QUEUE.hasRole(role), (boolean)r[6]);
Assert.assertEquals(CheckType.MANAGE.hasRole(role), (boolean)r[7]);
Assert.assertEquals(CheckType.BROWSE.hasRole(role), (boolean)r[8]);
Assert.assertEquals(CheckType.CREATE_ADDRESS.hasRole(role), (boolean)r[9]);
Assert.assertEquals(CheckType.DELETE_ADDRESS.hasRole(role), (boolean)r[10]);
Assert.assertEquals(CheckType.values().length + 1, r.length);
session.deleteQueue(queue);
}