Fix various build errors.

This commit is contained in:
robin shine 2013-10-24 10:43:50 +08:00
parent 6a60e59199
commit c1ae93e29d
9 changed files with 816 additions and 678 deletions

View File

@ -37,6 +37,13 @@
<artifactId>commons.loader</artifactId> <artifactId>commons.loader</artifactId>
<version>1.0.31</version> <version>1.0.31</version>
</dependency> </dependency>
<dependency>
<groupId>com.pmease</groupId>
<artifactId>commons.loader</artifactId>
<version>1.0.31</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>

View File

@ -31,22 +31,18 @@
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId> <artifactId>jetty-server</artifactId>
<version>${jettyVersion}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId> <artifactId>jetty-servlets</artifactId>
<version>${jettyVersion}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId> <artifactId>jetty-servlet</artifactId>
<version>${jettyVersion}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId> <artifactId>jetty-websocket</artifactId>
<version>${jettyVersion}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<repositories> <repositories>
@ -68,6 +64,5 @@
</repositories> </repositories>
<properties> <properties>
<moduleClass>com.pmease.commons.jetty.JettyModule</moduleClass> <moduleClass>com.pmease.commons.jetty.JettyModule</moduleClass>
<jettyVersion>8.1.10.v20130312</jettyVersion>
</properties> </properties>
</project> </project>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>commons.loader</artifactId> <artifactId>commons.loader</artifactId>
<parent> <parent>
@ -20,6 +21,16 @@
<plugin> <plugin>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
</plugin> </plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>gitop.core</artifactId> <artifactId>gitop.core</artifactId>
<parent> <parent>
@ -51,6 +52,13 @@
<artifactId>commons.jetty</artifactId> <artifactId>commons.jetty</artifactId>
<version>1.0.31</version> <version>1.0.31</version>
</dependency> </dependency>
<dependency>
<groupId>com.pmease</groupId>
<artifactId>commons.loader</artifactId>
<version>1.0.31</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
<repository> <repository>

View File

@ -20,7 +20,7 @@ import javax.validation.constraints.NotNull;
import com.pmease.commons.editable.annotation.Editable; import com.pmease.commons.editable.annotation.Editable;
import com.pmease.commons.hibernate.AbstractEntity; import com.pmease.commons.hibernate.AbstractEntity;
import com.pmease.gitop.core.Gitop; import com.pmease.gitop.core.Gitop;
import com.pmease.gitop.core.gatekeeper.AlwaysAccept; import com.pmease.gitop.core.gatekeeper.ApprovedByAuthorizedUsers;
import com.pmease.gitop.core.gatekeeper.GateKeeper; import com.pmease.gitop.core.gatekeeper.GateKeeper;
import com.pmease.gitop.core.manager.BranchManager; import com.pmease.gitop.core.manager.BranchManager;
import com.pmease.gitop.core.manager.UserManager; import com.pmease.gitop.core.manager.UserManager;
@ -62,7 +62,7 @@ public class Project extends AbstractEntity implements UserBelonging {
private GeneralOperation defaultAuthorizedOperation = GeneralOperation.NO_ACCESS; private GeneralOperation defaultAuthorizedOperation = GeneralOperation.NO_ACCESS;
@Column(nullable=false) @Column(nullable=false)
private GateKeeper gateKeeper = new AlwaysAccept(); private GateKeeper gateKeeper = new ApprovedByAuthorizedUsers();
@Column(nullable=false) @Column(nullable=false)
private Date createdAt = new Date(); private Date createdAt = new Date();

View File

@ -109,7 +109,11 @@ public class GitFilter implements Filter {
} }
git.upload().input(ServletUtils.getInputStream(request)).output(response.getOutputStream()).call(); git.upload().input(ServletUtils.getInputStream(request)).output(response.getOutputStream()).call();
} else { } else {
if (!SecurityUtils.getSubject().isPermitted(ObjectPermission.ofProjectWrite(project))) { /*
* We intentionally use read permission here for write operation so that gate keeper gets the
* chance to run to possibly create a merge request for non-permitted user.
*/
if (!SecurityUtils.getSubject().isPermitted(ObjectPermission.ofProjectRead(project))) {
throw new UnauthorizedException("You do not have permission to push to this project."); throw new UnauthorizedException("You do not have permission to push to this project.");
} }
git.receive().input(ServletUtils.getInputStream(request)).output(response.getOutputStream()).call(); git.receive().input(ServletUtils.getInputStream(request)).output(response.getOutputStream()).call();
@ -143,7 +147,11 @@ public class GitFilter implements Filter {
writeInitial(response, service); writeInitial(response, service);
git.advertiseUploadRefs().output(response.getOutputStream()).call(); git.advertiseUploadRefs().output(response.getOutputStream()).call();
} else { } else {
if (!SecurityUtils.getSubject().isPermitted(ObjectPermission.ofProjectWrite(project))) { /*
* We intentionally use read permission here for write operation so that gate keeper gets the
* chance to run to possibly create a merge request for non-permitted user.
*/
if (!SecurityUtils.getSubject().isPermitted(ObjectPermission.ofProjectRead(project))) {
throw new UnauthorizedException("You do not have permission to push to this project."); throw new UnauthorizedException("You do not have permission to push to this project.");
} }
writeInitial(response, service); writeInitial(response, service);

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.pmease</groupId> <groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId> <artifactId>parent.general</artifactId>
@ -52,6 +53,19 @@
<configuration> <configuration>
<lifecycleMappingMetadata> <lifecycleMappingMetadata>
<pluginExecutions> <pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>enforce</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution> <pluginExecution>
<pluginExecutionFilter> <pluginExecutionFilter>
<groupId>com.pmease</groupId> <groupId>com.pmease</groupId>
@ -83,7 +97,7 @@
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
<ignore/> <ignore />
</action> </action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>
@ -229,6 +243,28 @@
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-java</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>1.7.0</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build> </build>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
@ -322,6 +358,31 @@
<artifactId>ant</artifactId> <artifactId>ant</artifactId>
<version>1.9.1</version> <version>1.9.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jettyVersion}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
@ -397,6 +458,7 @@
<logbackVersion>1.0.11</logbackVersion> <logbackVersion>1.0.11</logbackVersion>
<dropwizardVersion>0.7.0-SNAPSHOT</dropwizardVersion> <dropwizardVersion>0.7.0-SNAPSHOT</dropwizardVersion>
<jerseyVersion>1.17.1</jerseyVersion> <jerseyVersion>1.17.1</jerseyVersion>
<jettyVersion>8.1.10.v20130312</jettyVersion>
<jacksonVersion>2.2.3</jacksonVersion> <jacksonVersion>2.2.3</jacksonVersion>
<powermockVersion>1.5.1</powermockVersion> <powermockVersion>1.5.1</powermockVersion>
</properties> </properties>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.pmease</groupId> <groupId>com.pmease</groupId>
<artifactId>plugin.maven</artifactId> <artifactId>plugin.maven</artifactId>
@ -30,7 +31,7 @@
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
<ignore/> <ignore />
</action> </action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>
@ -44,8 +45,54 @@
<target>1.7</target> <target>1.7</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>enforce</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-java</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>1.7.0</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build> </build>
<dependencies> <dependencies>
<dependency> <dependency>