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

Commit c520e36

Browse files
committed
Getting clone URL:s with admin permission #119
1 parent fef14cd commit c520e36

File tree

7 files changed

+156
-65
lines changed

7 files changed

+156
-65
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@
33
Changelog of Pull Request Notifier for Bitbucket.
44

55
## Unreleased
6+
### GitHub [#119](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/119) You are not permitted to access this resource
7+
Getting clone URL:s with admin permission
8+
9+
[f09e3bfac1e030f](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/f09e3bfac1e030f) Tomas Bjerre *2016-05-28 16:29:17*
10+
611
### No issue
12+
Show buttons only on PR where the button belongs to
13+
14+
[2cfaea05e0312d4](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/2cfaea05e0312d4) Stefan Anzinger *2016-05-27 09:00:34*
15+
16+
Updating screenshots
17+
18+
[eb2b5922f7473ce](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/eb2b5922f7473ce) Tomas Bjerre *2016-05-15 18:25:55*
19+
720
Docker
821

922
[76aa6838a73a556](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/76aa6838a73a556) Tomas Bjerre *2016-05-15 10:24:55*

src/main/java/se/bjurr/prnfb/service/PrnfbRenderer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.atlassian.bitbucket.repository.RepositoryService;
1717
import com.atlassian.bitbucket.server.ApplicationPropertiesService;
1818
import com.atlassian.bitbucket.user.ApplicationUser;
19+
import com.atlassian.bitbucket.user.SecurityService;
1920
import com.google.common.annotations.VisibleForTesting;
2021
import com.google.common.base.Supplier;
2122

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

3739
PrnfbRenderer(PullRequest pullRequest, PrnfbPullRequestAction pullRequestAction, ApplicationUser applicationUser,
3840
RepositoryService repositoryService, ApplicationPropertiesService propertiesService,
39-
PrnfbNotification prnfbNotification, Map<PrnfbVariable, Supplier<String>> variables) {
41+
PrnfbNotification prnfbNotification, Map<PrnfbVariable, Supplier<String>> variables, SecurityService securityService) {
4042
this.pullRequest = pullRequest;
4143
this.pullRequestAction = pullRequestAction;
4244
this.applicationUser = applicationUser;
4345
this.repositoryService = repositoryService;
4446
this.prnfbNotification = prnfbNotification;
4547
this.propertiesService = propertiesService;
4648
this.variables = variables;
49+
this.securityService = securityService;
4750
}
4851

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

src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,27 @@
99
import com.atlassian.bitbucket.pull.PullRequest;
1010
import com.atlassian.bitbucket.repository.RepositoryService;
1111
import com.atlassian.bitbucket.server.ApplicationPropertiesService;
12+
import com.atlassian.bitbucket.user.SecurityService;
1213
import com.google.common.base.Supplier;
1314

1415
public class PrnfbRendererFactory {
1516

1617
private final AuthenticationContext authenticationContext;
1718
private final ApplicationPropertiesService propertiesService;
1819
private final RepositoryService repositoryService;
20+
private final SecurityService securityService;
1921

2022
public PrnfbRendererFactory(RepositoryService repositoryService, ApplicationPropertiesService propertiesService,
21-
AuthenticationContext authenticationContext) {
23+
AuthenticationContext authenticationContext, SecurityService securityService) {
2224
this.repositoryService = repositoryService;
2325
this.propertiesService = propertiesService;
2426
this.authenticationContext = authenticationContext;
27+
this.securityService = securityService;
2528
}
2629

2730
public PrnfbRenderer create(PullRequest pullRequest, PrnfbPullRequestAction pullRequestAction,
2831
PrnfbNotification prnfbNotification, Map<PrnfbVariable, Supplier<String>> variables) {
2932
return new PrnfbRenderer(pullRequest, pullRequestAction, this.authenticationContext.getCurrentUser(),
30-
this.repositoryService, this.propertiesService, prnfbNotification, variables);
33+
this.repositoryService, this.propertiesService, prnfbNotification, variables, this.securityService);
3134
}
3235
}

0 commit comments

Comments
 (0)