Skip to content

Commit

Permalink
[FIXED JENKINS-45344] Be more specific until we have the generic impl…
Browse files Browse the repository at this point in the history
…ementations of everyone and nobody
  • Loading branch information
stephenc committed Jul 6, 2017
1 parent c8da81f commit e5619d6
Showing 1 changed file with 27 additions and 27 deletions.
Expand Up @@ -227,7 +227,7 @@ public List<SCMHeadAuthorityDescriptor> getTrustDescriptors() {
/**
* An {@link SCMHeadAuthority} that trusts nothing.
*/
public static class TrustNobody extends SCMHeadAuthority<SCMSourceRequest, ChangeRequestSCMHead2, SCMRevision> {
public static class TrustNobody extends SCMHeadAuthority<SCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {

/**
* Constructor.
Expand All @@ -240,7 +240,7 @@ public TrustNobody() {
* {@inheritDoc}
*/
@Override
public boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull ChangeRequestSCMHead2 head) {
public boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull PullRequestSCMHead head) {
return false;
}

Expand All @@ -254,17 +254,17 @@ public static class DescriptorImpl extends SCMHeadAuthorityDescriptor {
* {@inheritDoc}
*/
@Override
public boolean isApplicableToOrigin(@NonNull Class<? extends SCMHeadOrigin> originClass) {
return SCMHeadOrigin.Fork.class.isAssignableFrom(originClass);
} /**
* {@inheritDoc}
*/
@Override
public String getDisplayName() {
return Messages.ForkPullRequestDiscoveryTrait_nobodyDisplayName();
}


/**
* {@inheritDoc}
*/
@Override
public boolean isApplicableToOrigin(@NonNull Class<? extends SCMHeadOrigin> originClass) {
return SCMHeadOrigin.Fork.class.isAssignableFrom(originClass);
}
}
}

Expand All @@ -280,6 +280,15 @@ public static class TrustContributors
public TrustContributors() {
}

/**
* {@inheritDoc}
*/
@Override
protected boolean checkTrusted(@NonNull GiteaSCMSourceRequest request, @NonNull PullRequestSCMHead head) {
return !head.getOrigin().equals(SCMHeadOrigin.DEFAULT)
&& request.getCollaboratorNames().contains(head.getOriginOwner());
}

/**
* Our descriptor.
*/
Expand All @@ -302,29 +311,28 @@ public boolean isApplicableToOrigin(@NonNull Class<? extends SCMHeadOrigin> orig
return SCMHeadOrigin.Fork.class.isAssignableFrom(originClass);
}

} /**
* {@inheritDoc}
*/
@Override
protected boolean checkTrusted(@NonNull GiteaSCMSourceRequest request, @NonNull PullRequestSCMHead head) {
return !head.getOrigin().equals(SCMHeadOrigin.DEFAULT)
&& request.getCollaboratorNames().contains(head.getOriginOwner());
}


}

/**
* An {@link SCMHeadAuthority} that trusts everyone.
*/
public static class TrustEveryone extends SCMHeadAuthority<SCMSourceRequest, ChangeRequestSCMHead2, SCMRevision> {
public static class TrustEveryone extends SCMHeadAuthority<SCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {
/**
* Constructor.
*/
@DataBoundConstructor
public TrustEveryone() {
}

/**
* {@inheritDoc}
*/
@Override
protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull PullRequestSCMHead head) {
return true;
}

/**
* Our descriptor.
*/
Expand All @@ -346,14 +354,6 @@ public String getDisplayName() {
public boolean isApplicableToOrigin(@NonNull Class<? extends SCMHeadOrigin> originClass) {
return SCMHeadOrigin.Fork.class.isAssignableFrom(originClass);
}
} /**
* {@inheritDoc}
*/
@Override
protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull ChangeRequestSCMHead2 head) {
return true;
}


}
}

0 comments on commit e5619d6

Please sign in to comment.