From f306ef8552efe1580e9c16e1d944f5ed1dca4aae Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Mon, 24 Oct 2011 16:33:40 -0400
Subject: [PATCH] Object counts and refresh labels on all header panels
---
src/com/gitblit/client/GitblitClient.java | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/src/com/gitblit/client/GitblitClient.java b/src/com/gitblit/client/GitblitClient.java
index 76a6731..7991423 100644
--- a/src/com/gitblit/client/GitblitClient.java
+++ b/src/com/gitblit/client/GitblitClient.java
@@ -48,8 +48,10 @@
public final String account;
private final char[] password;
+
+ private volatile boolean allowManagement;
- private volatile boolean isAdmin;
+ private volatile boolean allowAdministration;
private volatile ServerSettings settings;
@@ -75,19 +77,32 @@
refreshRepositories();
try {
- settings = RpcUtils.getSettings(url, account, password);
- status = RpcUtils.getStatus(url, account, password);
refreshUsers();
- isAdmin = true;
+ allowManagement = true;
} catch (UnauthorizedException e) {
} catch (ForbiddenException e) {
} catch (IOException e) {
System.err.println(e.getMessage());
}
+
+ try {
+ refreshSettings();
+ status = RpcUtils.getStatus(url, account, password);
+ allowAdministration = true;
+ } catch (UnauthorizedException e) {
+ } catch (ForbiddenException e) {
+ } catch (IOException e) {
+ System.err.println(e.getMessage());
+ }
+
}
- public boolean allowAdmin() {
- return isAdmin;
+ public boolean allowManagement() {
+ return allowManagement;
+ }
+
+ public boolean allowAdministration() {
+ return allowAdministration;
}
public boolean isOwner(RepositoryModel model) {
@@ -121,6 +136,11 @@
allUsers.addAll(users);
return allUsers;
}
+
+ public ServerSettings refreshSettings() throws IOException {
+ settings = RpcUtils.getSettings(url, account, password);
+ return settings;
+ }
public List<FederationModel> refreshFederationRegistrations() throws IOException {
List<FederationModel> list = RpcUtils.getFederationRegistrations(url, account, password);
--
Gitblit v1.9.1