From 2e141ff31dedaa6dfefc4af47eda803d8dbb3eff Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Tue, 01 Sep 2015 08:49:02 -0400
Subject: [PATCH] Fix #909: Add missing SLFJ dependencies in Manager build
---
src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java b/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java
index 938226a..207f125 100644
--- a/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java
@@ -80,11 +80,11 @@
HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();
- List<RepositoryUrl> repositoryUrls = app().gitblit().getRepositoryUrls(req, user, repository);
+ List<RepositoryUrl> repositoryUrls = app().services().getRepositoryUrls(req, user, repository);
// grab primary url from the top of the list
primaryUrl = repositoryUrls.size() == 0 ? null : repositoryUrls.get(0);
- boolean canClone = primaryUrl != null && ((primaryUrl.permission == null) || primaryUrl.permission.atLeast(AccessPermission.CLONE));
+ boolean canClone = primaryUrl != null && (!primaryUrl.hasPermission() || primaryUrl.permission.atLeast(AccessPermission.CLONE));
if (repositoryUrls.size() == 0 || !canClone) {
// no urls, nothing to show.
@@ -145,7 +145,7 @@
fragment.add(content);
item.add(fragment);
- Label permissionLabel = new Label("permission", repoUrl.isExternal() ? externalPermission : repoUrl.permission.toString());
+ Label permissionLabel = new Label("permission", repoUrl.hasPermission() ? repoUrl.permission.toString() : externalPermission);
WicketUtils.setPermissionClass(permissionLabel, repoUrl.permission);
String tooltip = getProtocolPermissionDescription(repository, repoUrl);
WicketUtils.setHtmlTooltip(permissionLabel, tooltip);
@@ -165,7 +165,7 @@
if (repository.isMirror) {
urlPanel.add(WicketUtils.newImage("accessRestrictionIcon", "mirror_16x16.png",
getString("gb.isMirror")));
- } else if (app().gitblit().isServingRepositories()) {
+ } else if (app().services().isServingRepositories()) {
switch (repository.accessRestriction) {
case NONE:
urlPanel.add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
@@ -201,7 +201,7 @@
urlPanel.add(new Label("primaryUrl", primaryUrl.url).setRenderBodyOnly(true));
- Label permissionLabel = new Label("primaryUrlPermission", primaryUrl.isExternal() ? externalPermission : primaryUrl.permission.toString());
+ Label permissionLabel = new Label("primaryUrlPermission", primaryUrl.hasPermission() ? primaryUrl.permission.toString() : externalPermission);
String tooltip = getProtocolPermissionDescription(repository, primaryUrl);
WicketUtils.setHtmlTooltip(permissionLabel, tooltip);
urlPanel.add(permissionLabel);
@@ -234,8 +234,8 @@
// filter the urls for the client app
List<RepositoryUrl> urls = new ArrayList<RepositoryUrl>();
for (RepositoryUrl repoUrl : repositoryUrls) {
- if (clientApp.minimumPermission == null || repoUrl.permission == null) {
- // no minimum permission or external permissions, assume it is satisfactory
+ if (clientApp.minimumPermission == null || !repoUrl.hasPermission()) {
+ // no minimum permission or untracked permissions, assume it is satisfactory
if (clientApp.supportsTransport(repoUrl.url)) {
urls.add(repoUrl);
}
@@ -339,7 +339,7 @@
}
protected Label createPermissionBadge(String wicketId, RepositoryUrl repoUrl) {
- Label permissionLabel = new Label(wicketId, repoUrl.isExternal() ? externalPermission : repoUrl.permission.toString());
+ Label permissionLabel = new Label(wicketId, repoUrl.hasPermission() ? repoUrl.permission.toString() : externalPermission);
WicketUtils.setPermissionClass(permissionLabel, repoUrl.permission);
String tooltip = getProtocolPermissionDescription(repository, repoUrl);
WicketUtils.setHtmlTooltip(permissionLabel, tooltip);
@@ -369,18 +369,7 @@
RepositoryUrl repoUrl) {
if (!urlPermissionsMap.containsKey(repoUrl.url)) {
String note;
- if (repoUrl.isExternal()) {
- String protocol;
- int protocolIndex = repoUrl.url.indexOf("://");
- if (protocolIndex > -1) {
- // explicit protocol specified
- protocol = repoUrl.url.substring(0, protocolIndex);
- } else {
- // implicit SSH url
- protocol = "ssh";
- }
- note = MessageFormat.format(getString("gb.externalPermissions"), protocol);
- } else {
+ if (repoUrl.hasPermission()) {
note = null;
String key;
switch (repoUrl.permission) {
@@ -411,6 +400,17 @@
String description = MessageFormat.format(pattern, repoUrl.permission.toString());
note = description;
}
+ } else {
+ String protocol;
+ int protocolIndex = repoUrl.url.indexOf("://");
+ if (protocolIndex > -1) {
+ // explicit protocol specified
+ protocol = repoUrl.url.substring(0, protocolIndex);
+ } else {
+ // implicit SSH url
+ protocol = "ssh";
+ }
+ note = MessageFormat.format(getString("gb.externalPermissions"), protocol);
}
urlPermissionsMap.put(repoUrl.url, note);
}
--
Gitblit v1.9.1