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

Commit 6f690ab

Browse files
committed
Allowing anyone admin moved project/repo #240
1 parent aa4af99 commit 6f690ab

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ Changelog of Pull Request Notifier for Bitbucket.
66
### GitHub [#237](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/237) Listing all notifications via API takes a long time
77
Speeding up restriction filter
88

9-
[e5b6bd9882559e8](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/e5b6bd9882559e8) Tomas Bjerre *2017-08-02 18:06:39*
9+
[aa4af99648b9389](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/aa4af99648b9389) Tomas Bjerre *2017-08-02 18:07:08*
10+
11+
### GitHub [#240](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/240) Button config does not show up in the plugin config page.
12+
Allowing anyone admin moved project/repo
13+
14+
[ba3d3c131a3d3da](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/ba3d3c131a3d3da) Tomas Bjerre *2017-08-02 19:49:14*
1015

1116
### No issue
1217
doc

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

+12-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import static com.atlassian.bitbucket.permission.Permission.REPO_ADMIN;
55
import static com.atlassian.bitbucket.permission.Permission.SYS_ADMIN;
66
import static com.google.common.base.Strings.emptyToNull;
7-
import static com.google.common.base.Throwables.propagate;
87
import static com.google.common.collect.Iterables.filter;
98
import static org.slf4j.LoggerFactory.getLogger;
109
import static se.bjurr.prnfb.settings.USER_LEVEL.ADMIN;
@@ -84,7 +83,8 @@ public Project perform() throws Exception {
8483
}
8584
});
8685
} catch (final Exception e) {
87-
throw propagate(e);
86+
LOG.error(e.getMessage(), e);
87+
return null;
8888
}
8989
}
9090

@@ -101,7 +101,8 @@ public Repository perform() throws Exception {
101101
}
102102
});
103103
} catch (final Exception e) {
104-
throw propagate(e);
104+
LOG.error(e.getMessage(), e);
105+
return null;
105106
}
106107
}
107108

@@ -117,8 +118,11 @@ public boolean isAdmin(UserKey userKey, String projectKey, String repositorySlug
117118
if (projectKey != null && repositorySlug == null) {
118119
final Project project = getProject(projectKey);
119120
if (project == null) {
120-
LOG.error("Button with project " + projectKey + " configured. But no such project exists!");
121-
return false;
121+
LOG.error(
122+
"Project "
123+
+ projectKey
124+
+ " configured. But no such project exists! Allowing anyone to admin.");
125+
return true;
122126
}
123127
final boolean isAllowed = permissionService.hasProjectPermission(project, PROJECT_ADMIN);
124128
if (isAllowed) {
@@ -130,12 +134,12 @@ public boolean isAdmin(UserKey userKey, String projectKey, String repositorySlug
130134
final Repository repository = getRepo(projectKey, repositorySlug);
131135
if (repository == null) {
132136
LOG.error(
133-
"Button with project "
137+
"Project "
134138
+ projectKey
135139
+ " and repo "
136140
+ repositorySlug
137-
+ " configured. But no such repo exists!");
138-
return false;
141+
+ " configured. But no such repo exists! Allowing anyone to admin.");
142+
return true;
139143
}
140144
return permissionService.hasRepositoryPermission(repository, REPO_ADMIN);
141145
}

0 commit comments

Comments
 (0)