/** * Tests if user is in group. * * @param req The webscript request * @param userId The id of the user to test * @param groupId The if of the group to test the user against * @return true of user is in group */ protected boolean isUserInGroup(WebScriptRequest req, String userId, String groupId) { if (userId != null) { List<Group> groups = getIdentityService().findGroupsByUser(userId); for (Group group : groups) { if (config.getAdminGroupId().equals(group.getId())) { return true; } } } return false; }
/** * Tests if user has admin role. * * @param req The webscript request * @return true if the user has admin role */ protected boolean isAdmin(WebScriptRequest req) { return isUserInGroup(req, getCurrentUserId(req), config.getAdminGroupId()); }
/** * Tests if user has manager role. * * @param req The webscript request. * @return true if the user has manager role */ protected boolean isManager(WebScriptRequest req) { return isUserInGroup(req, getCurrentUserId(req), config.getManagerGroupId()); }
/** * Returns the process engine. * * @return The process engine */ protected ProcessEngine getProcessEngine() { return ProcessEngines.getProcessEngine(config.getEngine()); }