use of alfio.model.modification.OrganizationModification in project alf.io by alfio-event.
the class UserCreatorBeforeLoginFilter method doFilter.
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
// ensure organization/user
if (requestMatcher.matches(req) && req.getParameter("username") != null && req.getParameter("password") != null) {
String username = req.getParameter("username");
if (!userManager.usernameExists(username)) {
var organizationModification = new OrganizationModification(null, "Demo organization", username, username, null, null);
int orgId = userManager.createOrganization(organizationModification);
userManager.insertUser(orgId, username, "", "", username, Role.OWNER, User.Type.DEMO, req.getParameter("password"), null, null);
}
}
chain.doFilter(request, response);
}
Aggregations