From b701ed7c4e138c4aaa3acb029f6e35fdf01388e4 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 01 Nov 2012 17:32:13 -0400
Subject: [PATCH] Ignore permission definitions for admins, it just confuses things
---
src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java b/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java
index d6bd565..9431df8 100644
--- a/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java
+++ b/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java
@@ -89,14 +89,14 @@
final RegistrantAccessPermission entry = item.getModelObject();
if (RegistrantType.REPOSITORY.equals(entry.registrantType)) {
String repoName = StringUtils.stripDotGit(entry.registrant);
- if (StringUtils.findInvalidCharacter(repoName) == null) {
+ if (!entry.isMissing() && StringUtils.findInvalidCharacter(repoName) == null) {
// repository, strip .git and show swatch
Label registrant = new Label("registrant", repoName);
WicketUtils.setCssClass(registrant, "repositorySwatch");
WicketUtils.setCssBackground(registrant, repoName);
item.add(registrant);
} else {
- // likely a regex
+ // regex or missing
Label label = new Label("registrant", entry.registrant);
WicketUtils.setCssStyle(label, "font-weight: bold;");
item.add(label);
@@ -147,7 +147,16 @@
item.add(regex);
break;
default:
- item.add(new Label("pType", "").setVisible(false));
+ if (entry.isMissing()) {
+ // repository is missing, this permission will be removed on save
+ Label missing = new Label("pType", getString("gb.missing"));
+ WicketUtils.setCssClass(missing, "label label-important");
+ WicketUtils.setHtmlTooltip(missing, getString("gb.missingPermission"));
+ item.add(missing);
+ } else {
+ // standard permission
+ item.add(new Label("pType", "").setVisible(false));
+ }
break;
}
@@ -159,9 +168,9 @@
// only allow changing an explicitly defined permission
// this is designed to prevent changing a regex permission in
// a repository
- permissionChoice.setEnabled(entry.isEditable);
+ permissionChoice.setEnabled(entry.mutable);
permissionChoice.setOutputMarkupId(true);
- if (entry.isEditable) {
+ if (entry.mutable) {
permissionChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = 1L;
@@ -181,7 +190,7 @@
// filter out registrants we already have permissions for
final List<String> registrants = new ArrayList<String>(allRegistrants);
for (RegistrantAccessPermission rp : permissions) {
- if (rp.isEditable) {
+ if (rp.mutable) {
// remove editable duplicates
// this allows for specifying an explicit permission
registrants.remove(rp.registrant);
--
Gitblit v1.9.1