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

Commit 067014d

Browse files
committed
Avoiding crash when administring global admin page as admin #129
* Did not correctly check for repo level admin privilegies.
1 parent 021d750 commit 067014d

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

CHANGELOG.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
Changelog of Pull Request Notifier for Bitbucket.
44

5+
## Unreleased
6+
### GitHub [#129](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/129) Unable to use wildcard for 'Repository'
7+
Avoiding crash when administring global admin page as admin
8+
9+
* Did not correctly check for repo level admin privilegies.
10+
11+
[7404bb4bb5016c7](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/7404bb4bb5016c7) Tomas Bjerre *2016-07-05 20:31:25*
12+
13+
## 2.28
14+
### No issue
15+
Doc
16+
17+
[620ae59a58aaa9d](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/620ae59a58aaa9d) Tomas Bjerre *2016-06-29 18:47:19*
18+
519
## 2.27
620
### GitHub [#128](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/128) Trigger button not showing up.
721
Making buttons compatible with 4.7.1
@@ -247,12 +261,12 @@ and a lot easier to add multiple actions.
247261
### GitHub [#93](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/93) Get reviewers of pr
248262
update: update changelog.md and readme.md.
249263

250-
[60732c85dbda9a8](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/60732c85dbda9a8) 张盟 *2016-01-25 14:24:07*
264+
[60732c85dbda9a8](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/60732c85dbda9a8) ?? *2016-01-25 14:24:07*
251265

252266
### No issue
253267
update: support reviewers list
254268

255-
[fcd612e0d9512a2](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/fcd612e0d9512a2) 张盟 *2016-01-25 09:15:49*
269+
[fcd612e0d9512a2](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/fcd612e0d9512a2) ?? *2016-01-25 09:15:49*
256270

257271
Correcting link to blog post in README.md
258272

@@ -751,6 +765,8 @@ java.util.Base64 is available since 1.8 and javax.xml.bind.DatatypeConverter sin
751765

752766
[36f99c11d31c763](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/36f99c11d31c763) Raimana *2015-04-01 09:24:20*
753767

768+
## 1.1
769+
### No issue
754770
Adding support for PULL_REQUEST_FROM/TO_HASH, filters and fixing authentication bug
755771
* Making it compatible with Stash 2.12.0
756772
* Some more documentation

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static com.atlassian.bitbucket.permission.Permission.PROJECT_ADMIN;
44
import static com.atlassian.bitbucket.permission.Permission.REPO_ADMIN;
5+
import static com.google.common.base.Strings.emptyToNull;
56
import static com.google.common.collect.Iterables.filter;
67
import static se.bjurr.prnfb.settings.USER_LEVEL.ADMIN;
78
import static se.bjurr.prnfb.settings.USER_LEVEL.EVERYONE;
@@ -54,6 +55,10 @@ public boolean isAdmin(UserKey userKey, String projectKey, String repositorySlug
5455
if (isAdmin) {
5556
return isAdmin;
5657
}
58+
59+
projectKey = emptyToNull(projectKey);
60+
repositorySlug = emptyToNull(repositorySlug);
61+
5762
if (projectKey != null && repositorySlug == null) {
5863
Project project = this.projectService.getByKey(projectKey);
5964
return this.permissionService.hasProjectPermission(project, PROJECT_ADMIN);

src/main/resources/admin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ define('plugin/prnfb/admin', [
33
'aui',
44
'plugin/prnfb/utils'
55
], function($, AJS, utils) {
6-
var settingsAdminUrlPostUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings"; 
6+
var settingsAdminUrlPostUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings";
77
var settingsAdminUrl = settingsAdminUrlPostUrl;
88

9-
var notificationsAdminUrlPostUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings/notifications"; 
9+
var notificationsAdminUrlPostUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings/notifications";
1010
var notificationsAdminUrl = notificationsAdminUrlPostUrl;
1111

12-
var buttonsAdminUrlPostUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings/buttons"; 
12+
var buttonsAdminUrlPostUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings/buttons";
1313
var buttonsAdminUrl = buttonsAdminUrlPostUrl;
1414

1515
if ($('#prnfbRepositorySlug').length !== 0) {

src/main/resources/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ define('plugin/prnfb/utils', [
5252
}
5353

5454
function getProjects(whenDone) {
55-
var projectsUrl = AJS.contextPath() + "/rest/api/1.0/projects?limit=999999"; 
55+
var projectsUrl = AJS.contextPath() + "/rest/api/1.0/projects?limit=999999";
5656
$.getJSON(projectsUrl, function(data) {
5757
whenDone(data);
5858
});
@@ -83,7 +83,7 @@ define('plugin/prnfb/utils', [
8383
whenDone();
8484
return;
8585
}
86-
var reposUrl = AJS.contextPath() + "/rest/api/1.0/projects/" + projectKey + "/repos?limit=999999"; 
86+
var reposUrl = AJS.contextPath() + "/rest/api/1.0/projects/" + projectKey + "/repos?limit=999999";
8787
$.getJSON(reposUrl, function(data) {
8888
whenDone(data);
8989
});

0 commit comments

Comments
 (0)