Skip to content

Commit

Permalink
Merge pull request #200 from diging/develop
Browse files Browse the repository at this point in the history
Prepare release
  • Loading branch information
jdamerow authored Apr 7, 2021
2 parents 904946a + b9b5d3c commit 9a1a020
Show file tree
Hide file tree
Showing 264 changed files with 11,783 additions and 12,877 deletions.
24 changes: 24 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Guidelines for Pull Requests

If you haven't yet read our code review guidelines, please do so, You can find them [here](https://diging.atlassian.net/wiki/spaces/DIGING/pages/2256076801/Code+Review+Guidelines).

Please confirm the following by adding an x for each item (turn `[ ]` into `[x]`).

- [ ] I have removed all code style changes that are not necessary (e.g. changing blanks across the whole file that don’t need to be changed, adding empty lines in parts other than your own code)
- [ ] I am not making any changes to files that don’t have any effect (e.g. imports added that don’t need to be added)
- [ ] I do not have any sysout statements in my code or commented out code that isn’t needed anymore
- [ ] I am not reformatting any files in the wrong format or without cause.
- [ ] I am not changing file encoding or line endings to something else than UTF-8, LF
- [ ] My pull request does not show an insane amount of files being changed although my ticket only requires a few files being changed
- [ ] I have added Javadoc/documentation where appropriate
- [ ] I have added test cases where appropriate
- [ ] I have explained any part of my code/implementation decisions that is not be self-explanatory

## Please provide a brief description of your ticket
(you can copy the ticket if it hasn't changed)

...Put description here...

## Anything else the reviewer needs to know?

... describe here ...
1 change: 1 addition & 0 deletions Docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.DS_Store
41 changes: 35 additions & 6 deletions vspace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
<org.slf4j-version>1.7.5</org.slf4j-version>
<spring.version>5.0.7.RELEASE</spring.version>
<spring-data.version>Kay-SR8</spring-data.version>
<spring-security-version>4.1.5.RELEASE</spring-security-version>
<javers.version>3.10.1</javers.version>
<spring-security-version>5.3.3.RELEASE</spring-security-version>
<thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
<javers.version>5.11.1</javers.version>
<simple-users-version>0.5</simple-users-version>
<admin.username>admin</admin.username>
<admin.password>$2a$04$ug2wdYfAW8Ey/DwjUdPuLufgrMqbhNnTmr1QEUNZnoWF1xGitSBae</admin.password>
Expand Down Expand Up @@ -92,7 +93,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -185,13 +186,41 @@
</exclusions>
<scope>runtime</scope>
</dependency>

<!-- MarkDown -->
<dependency>
<groupId>com.atlassian.commonmark</groupId>
<artifactId>commonmark</artifactId>
<version>0.15.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring5 -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
<version>${thymeleaf.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/nz.net.ultraq.thymeleaf/thymeleaf-layout-dialect -->
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
<version>2.4.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity5 -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>

<!-- Testing -->
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
Expand Down Expand Up @@ -257,13 +286,13 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
<version>8.0.16</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.10.4</version>
<version>2.10.0.pr1</version>
</dependency>

<!-- Javers -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package edu.asu.diging.simpleusers.web.admin;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import edu.asu.diging.simpleusers.core.config.ConfigurationProvider;
import edu.asu.diging.simpleusers.core.service.IUserManager;
import edu.asu.diging.vspace.core.services.IExhibitionManager;

@Controller
public class ListUsersController extends AbstractController {

public final static String REQUEST_MAPPING_PATH = "list";

@Autowired
private ConfigurationProvider configProvider;

@Autowired
private IUserManager userManager;

@Autowired
private IExhibitionManager exhibitionManager;

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
ModelAndView model = new ModelAndView();
model.addObject("users", userManager.findAll());
model.addObject("exhibition",exhibitionManager.getStartExhibition());
model.setViewName(configProvider.getUserListView());
return model;
}
}
50 changes: 28 additions & 22 deletions vspace/src/main/java/edu/asu/diging/vspace/config/AuditConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package edu.asu.diging.vspace.config;

import java.util.Map;

import org.javers.common.collections.Maps;
import org.javers.core.Javers;
import org.javers.hibernate.integration.HibernateUnproxyObjectAccessHook;
import org.javers.repository.sql.ConnectionProvider;
Expand All @@ -17,48 +20,51 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;

import com.google.common.collect.ImmutableMap;

@Configuration
public class AuditConfig {

@Autowired
private PlatformTransactionManager txManager;

@Bean
public Javers javers() {
JaversSqlRepository sqlRepository = SqlRepositoryBuilder
@Autowired
private PlatformTransactionManager txManager;

@Bean
public Javers javers() {
JaversSqlRepository sqlRepository = SqlRepositoryBuilder
.sqlRepository()
.withConnectionProvider(jpaConnectionProvider())
.withDialect(DialectName.MYSQL)
.build();

return TransactionalJaversBuilder
.javers()
.withTxManager(txManager)
.withObjectAccessHook(new HibernateUnproxyObjectAccessHook())
.registerJaversRepository(sqlRepository)
.build();
}
}

@Bean
@Bean
public ConnectionProvider jpaConnectionProvider() {
return new JpaHibernateConnectionProvider();
}
@Bean
public JaversSpringDataAuditableRepositoryAspect javersSpringDataAuditableAspect() {
return new JaversSpringDataAuditableRepositoryAspect(
javers(), authorProvider(), commitPropertiesProvider());
}
@Bean

@Bean
public JaversSpringDataAuditableRepositoryAspect javersSpringDataAuditableAspect() {
return new JaversSpringDataAuditableRepositoryAspect(
javers(), authorProvider(), commitPropertiesProvider());
}

@Bean
public AuthorProvider authorProvider() {
return new SpringSecurityAuthorProvider();
}
@Bean

@Bean
public CommitPropertiesProvider commitPropertiesProvider() {
return () -> ImmutableMap.of("key", "ok");
return new CommitPropertiesProvider() {
@Override
public Map<String, String> provideForCommittedObject(Object domainObject) {
return Maps.of("key", "ok");
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ Properties additionalProperties() {
properties.setProperty("hibernate.ejb.naming_strategy", "org.hibernate.cfg.ImprovedNamingStrategy");
return properties;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected void configure(HttpSecurity http) throws Exception {
.authorizeRequests()
// Anyone can access the urls
.antMatchers("/", "/exhibit/**", "/api/**", "/resources/**", "/login",
"/logout", "/register", "/reset/**", "/setup/admin").permitAll()
"/logout", "/register", "/reset/**", "/setup/admin", "/404").permitAll()
// The rest of the our application is protected.
.antMatchers("/users/**", "/admin/**", "/staff/user/**").hasRole("ADMIN")
.antMatchers("/staff/**").hasAnyRole("STAFF", "ADMIN")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package edu.asu.diging.vspace.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ServletConfig implements WebMvcConfigurer{

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package edu.asu.diging.vspace.config;
import java.nio.charset.Charset;

import org.apache.commons.io.Charsets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
import org.thymeleaf.templatemode.TemplateMode;

import nz.net.ultraq.thymeleaf.LayoutDialect;

@Configuration
public class ThymeleafConfig {

@Autowired
private ApplicationContext applicationContext;

@Bean
public SpringResourceTemplateResolver templateResolver() {
// SpringResourceTemplateResolver automatically integrates with Spring's own
// resource resolution infrastructure, which is highly recommended.
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
templateResolver.setApplicationContext(this.applicationContext);
templateResolver.setCharacterEncoding(Charset.defaultCharset().toString());
templateResolver.setPrefix("/WEB-INF/views/");
templateResolver.setSuffix(".html");
// HTML is the default value, added here for the sake of clarity.
templateResolver.setTemplateMode(TemplateMode.HTML);
// Template cache is true by default. Set to false if you want
// templates to be automatically updated when modified.
templateResolver.setCacheable(false);
return templateResolver;
}

@Bean
public SpringTemplateEngine templateEngine() {
// SpringTemplateEngine automatically applies SpringStandardDialect and
// enables Spring's own MessageSource message resolution mechanisms.
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
// Enabling the SpringEL compiler with Spring 4.2.4 or newer can
// speed up execution in most scenarios, but might be incompatible
// with specific cases when expressions in one template are reused
// across different data types, so this flag is "false" by default
// for safer backwards compatibility.
templateEngine.setEnableSpringELCompiler(true);
templateEngine.addDialect(new LayoutDialect());
templateEngine.addDialect(new SpringSecurityDialect());
return templateEngine;
}

@Bean
public ThymeleafViewResolver viewResolver() {
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
viewResolver.setTemplateEngine(templateEngine());
viewResolver.setCharacterEncoding(Charset.defaultCharset().toString());
return viewResolver;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@Configuration
@EnableAspectJAutoProxy
@ComponentScan({"edu.asu.diging.vspace", "edu.asu.diging.simpleusers"})
@EnableWebMvc
@PropertySource({"classpath:config.properties", "${appConfigFile:classpath:}/app.properties"})
public class VSpaceConfig {

Expand Down
Loading

0 comments on commit 9a1a020

Please sign in to comment.