// Not @Inject: here it is created and outjected
private RulesRepository rulesRepository;
@PostConstruct
public void createRulesRepository() {
User user = identity.getUser();
String username;
// TODO user should never be null, weld messes up the identity proxy?
if (user == null) {
log.warn("Creating RulesRepository with default username.");
// Do not use user name "anonymous" as this user is configured in JackRabbit SimpleLoginModule
// with limited privileges. In Guvnor, access control is done in a higher level.
username = DEFAULT_USERNAME;
} else {
username = user.getId();
}
doSecurityContextAssociation();
rulesRepository = new RulesRepository(repositoryStartupService.newSession(username));
}