Date lastLogin = dateFormat.parse(config.getString("servers", server, "lastLogin"));\r
String url = config.getString("servers", server, "url");\r
String account = config.getString("servers", server, "account");\r
- // FIXME this is pretty lame\r
- char[] password = new String(Base64.decode(config.getString("servers", server,\r
- "password"))).toCharArray();\r
+ char[] password;\r
+ String pw = config.getString("servers", server, "password");\r
+ if (StringUtils.isEmpty(pw)) {\r
+ password = new char[0];\r
+ } else {\r
+ // FIXME this is pretty lame\r
+ password = new String(Base64.decode(pw)).toCharArray();\r
+ }\r
GitblitRegistration reg = new GitblitRegistration(server, url, account, password);\r
reg.lastLogin = lastLogin;\r
registrations.put(reg.name, reg);\r
StoredConfig config = getConfig();\r
config.setString("servers", reg.name, "url", reg.url);\r
config.setString("servers", reg.name, "account", reg.account);\r
- // FIXME this is pretty lame\r
+ // FIXME this is pretty lame \r
config.setString("servers", reg.name, "password",\r
Base64.encodeBytes(new String(reg.password).getBytes("UTF-8")));\r
config.setString("servers", reg.name, "lastLogin", dateFormat.format(reg.lastLogin));\r
import java.util.Map;\r
\r
import com.gitblit.GitBlitException.ForbiddenException;\r
+import com.gitblit.GitBlitException.UnauthorizedException;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
import com.gitblit.models.FederationModel;\r
refreshUsers();\r
refreshFederationRegistrations();\r
isAdmin = true;\r
+ } catch (UnauthorizedException e) {\r
} catch (ForbiddenException e) {\r
} catch (IOException e) {\r
System.err.println(e.getMessage());\r
}\r
\r
public boolean isOwner(RepositoryModel model) {\r
- return account.equalsIgnoreCase(model.owner);\r
+ return account != null && account.equalsIgnoreCase(model.owner);\r
}\r
\r
public IStoredSettings getSettings() {\r
}\r
}\r
});\r
- \r
+\r
repositoriesTable.addMouseListener(new MouseAdapter() {\r
public void mouseClicked(MouseEvent e) {\r
- if (e.getClickCount() == 2) {\r
+ if (e.getClickCount() == 2 && gitblit.allowAdmin()) {\r
editRepository(getSelectedRepositories().get(0));\r
}\r
}\r
delUser.setEnabled(selected);\r
}\r
});\r
- \r
+\r
usersTable.addMouseListener(new MouseAdapter() {\r
public void mouseClicked(MouseEvent e) {\r
if (e.getClickCount() == 2) {\r
gitblit = null;\r
}\r
\r
- protected void refreshRepositories() { \r
+ protected void refreshRepositories() {\r
GitblitWorker worker = new GitblitWorker(GitblitPanel.this, RpcRequest.LIST_REPOSITORIES) {\r
@Override\r
protected Boolean doRequest() throws IOException {\r