identityService.createMembership("john", "sales");
identityService.createMembership("mary", "accounting");
identityService.createMembership("peter", "management");
Authorization demoAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
demoAuth.setUserId("demo");
demoAuth.setResource(USER);
demoAuth.setResourceId("demo");
demoAuth.addPermission(ALL);
authorizationService.saveAuthorization(demoAuth);
Authorization johnAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
johnAuth.setUserId("john");
johnAuth.setResource(USER);
johnAuth.setResourceId("john");
johnAuth.addPermission(ALL);
authorizationService.saveAuthorization(johnAuth);
Authorization maryAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
maryAuth.setUserId("mary");
maryAuth.setResource(USER);
maryAuth.setResourceId("mary");
maryAuth.addPermission(ALL);
authorizationService.saveAuthorization(maryAuth);
Authorization peterAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
peterAuth.setUserId("peter");
peterAuth.setResource(USER);
peterAuth.setResourceId("peter");
peterAuth.addPermission(ALL);
authorizationService.saveAuthorization(peterAuth);
Authorization accAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
accAuth.setGroupId("accounting");
accAuth.setResource(GROUP);
accAuth.setResourceId("accounting");
accAuth.addPermission(READ);
authorizationService.saveAuthorization(accAuth);
Authorization salesAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
salesAuth.setGroupId("sales");
salesAuth.setResource(GROUP);
salesAuth.setResourceId("sales");
salesAuth.addPermission(READ);
authorizationService.saveAuthorization(salesAuth);
Authorization manAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
manAuth.setGroupId("management");
manAuth.setResource(GROUP);
manAuth.setResourceId("management");
manAuth.addPermission(READ);
authorizationService.saveAuthorization(manAuth);
Authorization salesDemoAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
salesDemoAuth.setGroupId("sales");
salesDemoAuth.setResource(USER);
salesDemoAuth.setResourceId("demo");
salesDemoAuth.addPermission(READ);
authorizationService.saveAuthorization(salesDemoAuth);
Authorization salesJohnAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
salesJohnAuth.setGroupId("sales");
salesJohnAuth.setResource(USER);
salesJohnAuth.setResourceId("john");
salesJohnAuth.addPermission(READ);
authorizationService.saveAuthorization(salesJohnAuth);
Authorization manDemoAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
manDemoAuth.setGroupId("management");
manDemoAuth.setResource(USER);
manDemoAuth.setResourceId("demo");
manDemoAuth.addPermission(READ);
authorizationService.saveAuthorization(manDemoAuth);
Authorization manPeterAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
manPeterAuth.setGroupId("management");
manPeterAuth.setResource(USER);
manPeterAuth.setResourceId("peter");
manPeterAuth.addPermission(READ);
authorizationService.saveAuthorization(manPeterAuth);
Authorization accDemoAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
accDemoAuth.setGroupId("accounting");
accDemoAuth.setResource(USER);
accDemoAuth.setResourceId("demo");
accDemoAuth.addPermission(READ);
authorizationService.saveAuthorization(accDemoAuth);
Authorization accMaryAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
accMaryAuth.setGroupId("accounting");
accMaryAuth.setResource(USER);
accMaryAuth.setResourceId("mary");
accMaryAuth.addPermission(READ);
authorizationService.saveAuthorization(accMaryAuth);
List<String> groups = new ArrayList<String>();
groups.add("management");
groups.add("accounting");