#427 comments from github issue

This commit is contained in:
milena 2017-07-21 11:27:45 +02:00
parent 34c3642f61
commit f44d4352ac
4 changed files with 5 additions and 5 deletions

View File

@ -55,11 +55,11 @@ public class GitLabConnectionConfig extends GlobalConfiguration {
return super.configure(req, json);
}
public Boolean getUseAuthenticatedEndpoint() {
public boolean isUseAuthenticatedEndpoint() {
return useAuthenticatedEndpoint;
}
void setUseAuthenticatedEndpoint(Boolean useAuthenticatedEndpoint) {
void setUseAuthenticatedEndpoint(boolean useAuthenticatedEndpoint) {
this.useAuthenticatedEndpoint = useAuthenticatedEndpoint;
}

View File

@ -56,7 +56,7 @@ abstract class BuildWebHookAction implements WebHookAction {
}
private void checkPermission(Permission permission) {
if (((GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class)).getUseAuthenticatedEndpoint()) {
if (((GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class)).isUseAuthenticatedEndpoint()) {
if (!Jenkins.getActiveInstance().getACL().hasPermission(authentication, permission)) {
String message = Messages.AccessDeniedException2_MissingPermission(authentication.getName(), permission.group.title+"/"+permission.name);
LOGGER.finest("Unauthorized (Did you forget to add API Token to the web hook ?)");

View File

@ -2,7 +2,7 @@
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:c="/lib/credentials" xmlns:st="jelly:stapler">
<f:section title="Gitlab">
<f:entry title="${%Enable authentication for '/project' end-point}" field="useAuthenticatedEndpoint">
<f:checkbox/>
<f:checkbox default="true"/>
</f:entry>
<f:entry title="${%GitLab connections}">
<f:repeatable var="connection" items="${descriptor.connections}" name="connections">

View File

@ -95,7 +95,7 @@ public class GitLabConnectionConfigTest {
@Test
public void authenticationEnabled_anonymous_forbidden() throws IOException, URISyntaxException {
Boolean defaultValue = jenkins.get(GitLabConnectionConfig.class).getUseAuthenticatedEndpoint();
Boolean defaultValue = jenkins.get(GitLabConnectionConfig.class).isUseAuthenticatedEndpoint();
assertTrue(defaultValue);
jenkins.getInstance().setAuthorizationStrategy(new GlobalMatrixAuthorizationStrategy());
URL jenkinsURL = jenkins.getURL();