Skip to content
Permalink
Browse files

Merge pull request #23 from alexouzounis/permissionsEnhancment

[FIXED JENKINS-25942] Permissions enhancement
  • Loading branch information
hugueschabot committed Dec 6, 2014
2 parents 7e4caea + 5a5f87c commit be86a0e4f40332619e64b0fc6015b7700f2fecb1
@@ -14,13 +14,17 @@
import hudson.model.queue.CauseOfBlockage;
import hudson.remoting.AsyncFutureImpl;
import hudson.security.Permission;
import hudson.security.PermissionGroup;
import hudson.security.PermissionScope;
import jenkins.model.Jenkins;

import org.acegisecurity.AccessDeniedException;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.framework.io.LargeText;

import javax.servlet.ServletException;

import java.io.File;
import java.io.IOException;
import java.util.concurrent.Future;
@@ -31,11 +35,12 @@
* Type that represents the parameter of the action
*/
public abstract class AbstractSvnmergeTaskAction<P> extends TaskAction {
/*package*/ AbstractSvnmergeTaskAction() { // subtyping only allowed for this plugin
}
public static final PermissionGroup PERMISSIONS = new PermissionGroup(AbstractSvnmergeTaskAction.class, Messages._PermissionGroupName());
public static final Permission REBASE_PERMISSION = new Permission(PERMISSIONS,"Rebase",Messages._RebaseAction_PermissionDesc(),null, PermissionScope.ITEM);
public static final Permission INTEGRATE_PERMISSION = new Permission(PERMISSIONS,"Integrate",Messages._IntegrateAction_PermissionDesc(),null, PermissionScope.ITEM);

protected Permission getPermission() {
return Item.CONFIGURE;
/*package*/ AbstractSvnmergeTaskAction() { // subtyping only allowed for this plugin
}

public abstract AbstractProject<?,?> getProject();
@@ -14,8 +14,10 @@
import hudson.scm.SubversionSCM;
import hudson.scm.SubversionSCM.ModuleLocation;
import hudson.scm.SubversionSCM.SvnInfo;
import hudson.scm.SubversionTagAction;
import hudson.security.ACL;
import hudson.security.Permission;
import hudson.security.PermissionGroup;
import hudson.security.PermissionScope;
import hudson.util.LogTaskListener;
import jenkins.model.Jenkins;
import jenkins.plugins.svnmerge.FeatureBranchProperty.IntegrationResult;
@@ -29,9 +31,8 @@
import java.io.File;
import java.io.IOException;
import java.util.Hashtable;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;

import static java.util.logging.Level.WARNING;

/**
@@ -41,7 +42,12 @@
* @author Kohsuke Kawaguchi
*/
public class IntegrateAction extends AbstractSvnmergeTaskAction<IntegrateSetting> implements BuildBadgeAction {
public final AbstractBuild<?,?> build;

protected Permission getPermission() {
return INTEGRATE_PERMISSION;
}

public final AbstractBuild<?,?> build;

/**
* If the integration is successful, set to the revision of the commit of the merge.
@@ -9,11 +9,16 @@
import hudson.scm.SubversionSCM.SvnInfo;
import hudson.scm.SubversionTagAction;
import hudson.security.ACL;
import hudson.security.Permission;
import hudson.security.PermissionGroup;
import hudson.security.PermissionScope;
import jenkins.model.Jenkins;

import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import javax.servlet.ServletException;

import java.io.File;
import java.io.IOException;

@@ -23,6 +28,11 @@
* @author Kohsuke Kawaguchi
*/
public class RebaseAction extends AbstractSvnmergeTaskAction<RebaseSetting> {

protected Permission getPermission() {
return REBASE_PERMISSION;
}

public final AbstractProject<?,?> project;

public RebaseAction(AbstractProject<?,?> project) {
@@ -1 +1,4 @@
IntegrateAction.DisplayName={0} Integration
IntegrateAction.DisplayName={0} Integration
PermissionGroupName=SVNMerge
IntegrateAction.PermissionDesc= Allows to Integrate a branch upstream
RebaseAction.PermissionDesc= Allows to rebase from upstream

0 comments on commit be86a0e

Please sign in to comment.
You can’t perform that action at this time.