From d03aff630cbcd49f02d51f08ec59ac3cf7f41d0e Mon Sep 17 00:00:00 2001 From: James Moger Date: Sun, 23 Oct 2011 10:25:39 -0400 Subject: Separate management from administration in rpc servlet. Added skeleton mechanism to update server settings via rpc. --- src/com/gitblit/client/GitblitClient.java | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/com/gitblit/client/GitblitClient.java') diff --git a/src/com/gitblit/client/GitblitClient.java b/src/com/gitblit/client/GitblitClient.java index 76a67316..66675b16 100644 --- a/src/com/gitblit/client/GitblitClient.java +++ b/src/com/gitblit/client/GitblitClient.java @@ -48,8 +48,10 @@ public class GitblitClient implements Serializable { public final String account; private final char[] password; + + private volatile boolean allowManagement; - private volatile boolean isAdmin; + private volatile boolean allowAdministration; private volatile ServerSettings settings; @@ -74,20 +76,33 @@ public class GitblitClient implements Serializable { public void login() throws IOException { refreshRepositories(); + try { + refreshUsers(); + allowManagement = true; + } catch (UnauthorizedException e) { + } catch (ForbiddenException e) { + } catch (IOException e) { + System.err.println(e.getMessage()); + } + try { settings = RpcUtils.getSettings(url, account, password); status = RpcUtils.getStatus(url, account, password); - refreshUsers(); - isAdmin = true; + 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) { -- cgit v1.2.3