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>
<version>1.0.31</version>
</dependency>
<dependency>
<groupId>com.pmease</groupId>
<artifactId>commons.loader</artifactId>
<version>1.0.31</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>

View File

@ -31,22 +31,18 @@
<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>
</dependencies>
<repositories>
@ -68,6 +64,5 @@
</repositories>
<properties>
<moduleClass>com.pmease.commons.jetty.JettyModule</moduleClass>
<jettyVersion>8.1.10.v20130312</jettyVersion>
</properties>
</project>

View File

@ -1,6 +1,7 @@
<?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>
<artifactId>commons.loader</artifactId>
<parent>
@ -20,6 +21,16 @@
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>

View File

@ -1,6 +1,7 @@
<?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>
<artifactId>gitop.core</artifactId>
<parent>
@ -51,6 +52,13 @@
<artifactId>commons.jetty</artifactId>
<version>1.0.31</version>
</dependency>
<dependency>
<groupId>com.pmease</groupId>
<artifactId>commons.loader</artifactId>
<version>1.0.31</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>

View File

@ -20,7 +20,7 @@ import javax.validation.constraints.NotNull;
import com.pmease.commons.editable.annotation.Editable;
import com.pmease.commons.hibernate.AbstractEntity;
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.manager.BranchManager;
import com.pmease.gitop.core.manager.UserManager;
@ -62,7 +62,7 @@ public class Project extends AbstractEntity implements UserBelonging {
private GeneralOperation defaultAuthorizedOperation = GeneralOperation.NO_ACCESS;
@Column(nullable=false)
private GateKeeper gateKeeper = new AlwaysAccept();
private GateKeeper gateKeeper = new ApprovedByAuthorizedUsers();
@Column(nullable=false)
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();
} 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.");
}
git.receive().input(ServletUtils.getInputStream(request)).output(response.getOutputStream()).call();
@ -143,7 +147,11 @@ public class GitFilter implements Filter {
writeInitial(response, service);
git.advertiseUploadRefs().output(response.getOutputStream()).call();
} 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.");
}
writeInitial(response, service);

View File

@ -1,6 +1,7 @@
<?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>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
@ -52,6 +53,19 @@
<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>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.pmease</groupId>
@ -229,6 +243,28 @@
</plugin>
</plugins>
</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>
<dependencyManagement>
<dependencies>
@ -322,6 +358,31 @@
<artifactId>ant</artifactId>
<version>1.9.1</version>
</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>
</dependencyManagement>
<dependencies>
@ -397,6 +458,7 @@
<logbackVersion>1.0.11</logbackVersion>
<dropwizardVersion>0.7.0-SNAPSHOT</dropwizardVersion>
<jerseyVersion>1.17.1</jerseyVersion>
<jettyVersion>8.1.10.v20130312</jettyVersion>
<jacksonVersion>2.2.3</jacksonVersion>
<powermockVersion>1.5.1</powermockVersion>
</properties>

View File

@ -1,6 +1,7 @@
<?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>
<groupId>com.pmease</groupId>
<artifactId>plugin.maven</artifactId>
@ -44,8 +45,54 @@
<target>1.7</target>
</configuration>
</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>
</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>
<dependencies>
<dependency>