diff options
author | James Moger <james.moger@gitblit.com> | 2013-11-29 12:10:53 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-11-29 12:10:53 -0500 |
commit | 088b6f33671697dc8c15197b0a63eecf6d74f75f (patch) | |
tree | 876a067ca07fab96e63a02199826d85730ac68e0 /src/main | |
parent | 3811378e0ec542e1ec3139406bbf0fc395e9d3df (diff) | |
download | gitblit-088b6f33671697dc8c15197b0a63eecf6d74f75f.tar.gz gitblit-088b6f33671697dc8c15197b0a63eecf6d74f75f.zip |
Added filesystem write permission check (issue-345)
Change-Id: I0a3aced3b8e9887347888c85e469b74fc70931ad
Diffstat (limited to 'src/main')
4 files changed, 25 insertions, 5 deletions
diff --git a/src/main/java/com/gitblit/Constants.java b/src/main/java/com/gitblit/Constants.java index ee6de45d..d425cdac 100644 --- a/src/main/java/com/gitblit/Constants.java +++ b/src/main/java/com/gitblit/Constants.java @@ -70,7 +70,9 @@ public class Constants { public static final String BRANCH_GRAPH_PATH = "/graph/";
- public static final String BORDER = "***********************************************************";
+ public static final String BORDER = "*****************************************************************";
+
+ public static final String BORDER2 = "#################################################################";
public static final String FEDERATION_USER = "$gitblit";
diff --git a/src/main/java/com/gitblit/manager/AuthenticationManager.java b/src/main/java/com/gitblit/manager/AuthenticationManager.java index 8c66ce59..60687d44 100644 --- a/src/main/java/com/gitblit/manager/AuthenticationManager.java +++ b/src/main/java/com/gitblit/manager/AuthenticationManager.java @@ -108,10 +108,10 @@ public class AuthenticationManager implements IAuthenticationManager { String realm = settings.getString(Keys.realm.userService, "${baseFolder}/users.conf"); if (legacyRedirects.containsKey(realm)) { logger.warn(""); - logger.warn("#################################################################"); + logger.warn(Constants.BORDER2); logger.warn(" IUserService '{}' is obsolete!", realm); logger.warn(" Please set '{}={}'", "realm.authenticationProviders", legacyRedirects.get(realm)); - logger.warn("#################################################################"); + logger.warn(Constants.BORDER2); logger.warn(""); // conditionally override specified authentication providers diff --git a/src/main/java/com/gitblit/manager/RepositoryManager.java b/src/main/java/com/gitblit/manager/RepositoryManager.java index 0a3f6631..d24a06db 100644 --- a/src/main/java/com/gitblit/manager/RepositoryManager.java +++ b/src/main/java/com/gitblit/manager/RepositoryManager.java @@ -157,6 +157,8 @@ public class RepositoryManager implements IRepositoryManager { configureJGit(); configureCommitCache(); + confirmWriteAccess(); + return this; } @@ -1756,4 +1758,20 @@ public class RepositoryManager implements IRepositoryManager { daysToCache, commitCount, repoCount, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start))); } } + + protected void confirmWriteAccess() { + if (runtimeManager.isServingRepositories()) { + try { + File file = File.createTempFile(".test-", ".txt", getRepositoriesFolder()); + file.delete(); + } catch (Exception e) { + logger.error(""); + logger.error(Constants.BORDER2); + logger.error("Please check filesystem permissions!"); + logger.error("FAILED TO WRITE TO REPOSITORIES FOLDER!!", e); + logger.error(Constants.BORDER2); + logger.error(""); + } + } + } } diff --git a/src/main/java/com/gitblit/manager/UserManager.java b/src/main/java/com/gitblit/manager/UserManager.java index 19943d71..67b1d68f 100644 --- a/src/main/java/com/gitblit/manager/UserManager.java +++ b/src/main/java/com/gitblit/manager/UserManager.java @@ -94,10 +94,10 @@ public class UserManager implements IUserManager { // create the user service from the legacy config String realmKey = legacyBackingServices.get(realm); logger.warn(""); - logger.warn("#################################################################"); + logger.warn(Constants.BORDER2); logger.warn(" Key '{}' is obsolete!", realmKey); logger.warn(" Please set '{}={}'", Keys.realm.userService, settings.getString(realmKey, "${baseFolder}/users.conf")); - logger.warn("#################################################################"); + logger.warn(Constants.BORDER2); logger.warn(""); File realmFile = runtimeManager.getFileOrFolder(realmKey, "${baseFolder}/users.conf"); service = createUserService(realmFile); |