/******************************************************************************************************************** * Role Management : For Role Based Access Control ********************************************************************************************************************/ @Path("/roles/{role-name}") @PUT public void createRole(HttpRequest httpRequest, HttpResponder httpResponder, @PathParam("role-name") String roleName) throws Exception { ensureSecurityEnabled(); authorizer.createRole(new Role(roleName)); httpResponder.sendStatus(HttpResponseStatus.OK); createLogEntry(httpRequest, HttpResponseStatus.OK); }
/******************************************************************************************************************** * Role Management : For Role Based Access Control ********************************************************************************************************************/ @Path("/roles/{role-name}") @PUT public void createRole(HttpRequest httpRequest, HttpResponder httpResponder, @PathParam("role-name") String roleName) throws Exception { ensureSecurityEnabled(); authorizer.createRole(new Role(roleName)); httpResponder.sendStatus(HttpResponseStatus.OK); createLogEntry(httpRequest, HttpResponseStatus.OK); }
Role engineers = new Role("engineers"); authorizer.createRole(admins); authorizer.createRole(engineers); authorizer.createRole(admins); Assert.fail(String.format("Created a role %s which already exists. Should have failed.", admins.getName())); } catch (AlreadyExistsException expected) {