Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Commit

Permalink
Getting clone URL:s with admin permission #119
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed May 28, 2016
1 parent fef14cd commit c520e36
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 65 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@
Changelog of Pull Request Notifier for Bitbucket.

## Unreleased
### GitHub [#119](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/119) You are not permitted to access this resource
Getting clone URL:s with admin permission

[f09e3bfac1e030f](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/f09e3bfac1e030f) Tomas Bjerre *2016-05-28 16:29:17*

### No issue
Show buttons only on PR where the button belongs to

[2cfaea05e0312d4](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/2cfaea05e0312d4) Stefan Anzinger *2016-05-27 09:00:34*

Updating screenshots

[eb2b5922f7473ce](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/eb2b5922f7473ce) Tomas Bjerre *2016-05-15 18:25:55*

Docker

[76aa6838a73a556](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/76aa6838a73a556) Tomas Bjerre *2016-05-15 10:24:55*
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/se/bjurr/prnfb/service/PrnfbRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.atlassian.bitbucket.repository.RepositoryService;
import com.atlassian.bitbucket.server.ApplicationPropertiesService;
import com.atlassian.bitbucket.user.ApplicationUser;
import com.atlassian.bitbucket.user.SecurityService;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Supplier;

Expand All @@ -27,6 +28,7 @@ public class PrnfbRenderer {
private final PullRequest pullRequest;
private final PrnfbPullRequestAction pullRequestAction;
private final RepositoryService repositoryService;
private final SecurityService securityService;
/**
* Contains special variables that are only available for specific events like
* {@link PrnfbVariable#BUTTON_TRIGGER_TITLE} and
Expand All @@ -36,14 +38,15 @@ public class PrnfbRenderer {

PrnfbRenderer(PullRequest pullRequest, PrnfbPullRequestAction pullRequestAction, ApplicationUser applicationUser,
RepositoryService repositoryService, ApplicationPropertiesService propertiesService,
PrnfbNotification prnfbNotification, Map<PrnfbVariable, Supplier<String>> variables) {
PrnfbNotification prnfbNotification, Map<PrnfbVariable, Supplier<String>> variables, SecurityService securityService) {
this.pullRequest = pullRequest;
this.pullRequestAction = pullRequestAction;
this.applicationUser = applicationUser;
this.repositoryService = repositoryService;
this.prnfbNotification = prnfbNotification;
this.propertiesService = propertiesService;
this.variables = variables;
this.securityService = securityService;
}

public String render(String string, Boolean forUrl, ClientKeyStore clientKeyStore, Boolean shouldAcceptAnyCertificate) {
Expand All @@ -64,7 +67,7 @@ private String getRenderedString(String string, Boolean forUrl, ClientKeyStore c
throws UnsupportedEncodingException {
String resolved = variable.resolve(this.pullRequest, this.pullRequestAction, this.applicationUser,
this.repositoryService, this.propertiesService, this.prnfbNotification, this.variables, clientKeyStore,
shouldAcceptAnyCertificate);
shouldAcceptAnyCertificate, this.securityService);
return getRenderedStringResolved(string, forUrl, regExpStr, resolved);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,27 @@
import com.atlassian.bitbucket.pull.PullRequest;
import com.atlassian.bitbucket.repository.RepositoryService;
import com.atlassian.bitbucket.server.ApplicationPropertiesService;
import com.atlassian.bitbucket.user.SecurityService;
import com.google.common.base.Supplier;

public class PrnfbRendererFactory {

private final AuthenticationContext authenticationContext;
private final ApplicationPropertiesService propertiesService;
private final RepositoryService repositoryService;
private final SecurityService securityService;

public PrnfbRendererFactory(RepositoryService repositoryService, ApplicationPropertiesService propertiesService,
AuthenticationContext authenticationContext) {
AuthenticationContext authenticationContext, SecurityService securityService) {
this.repositoryService = repositoryService;
this.propertiesService = propertiesService;
this.authenticationContext = authenticationContext;
this.securityService = securityService;
}

public PrnfbRenderer create(PullRequest pullRequest, PrnfbPullRequestAction pullRequestAction,
PrnfbNotification prnfbNotification, Map<PrnfbVariable, Supplier<String>> variables) {
return new PrnfbRenderer(pullRequest, pullRequestAction, this.authenticationContext.getCurrentUser(),
this.repositoryService, this.propertiesService, prnfbNotification, variables);
this.repositoryService, this.propertiesService, prnfbNotification, variables, this.securityService);
}
}
Loading

0 comments on commit c520e36

Please sign in to comment.