]> source.dussan.org Git - gitblit.git/commitdiff
Added filesystem write permission check (issue-345)
authorJames Moger <james.moger@gitblit.com>
Fri, 29 Nov 2013 17:10:53 +0000 (12:10 -0500)
committerJames Moger <james.moger@gitblit.com>
Fri, 29 Nov 2013 17:10:53 +0000 (12:10 -0500)
Change-Id: I0a3aced3b8e9887347888c85e469b74fc70931ad

releases.moxie
src/main/java/com/gitblit/Constants.java
src/main/java/com/gitblit/manager/AuthenticationManager.java
src/main/java/com/gitblit/manager/RepositoryManager.java
src/main/java/com/gitblit/manager/UserManager.java

index 3a1b296c882c8ebec03c3aed6ae0c37818f9b8aa..47c63b9f49e43ba0ec7ca422a042982704fb0c33 100644 (file)
@@ -46,6 +46,7 @@ r20: {
        - Set Link: <url>; rel="canonical" http header for SEO (issue-304)
        - Added raw links to the commit, commitdiff, and compare pages (issue-319)
        - Support intradocument linking in Markdown content using [[WikiLinks]] syntax (issue-324)
+       - Added filesystem write permission check (issue-345) 
        - Support rendering confluence, mediawiki, textile, tracwiki, and twiki markup documents
        - Added setting to globally disable anonymous pushes in the receive pack
        - Added a normalized diffstat display to the commit, commitdiff, and compare pages
index ee6de45d32ec441a15173cf2506d33a51fa87993..d425cdac1fa230f1543ca526ac153c8166151776 100644 (file)
@@ -70,7 +70,9 @@ public class Constants {
 \r
        public static final String BRANCH_GRAPH_PATH = "/graph/";\r
 \r
-       public static final String BORDER = "***********************************************************";\r
+       public static final String BORDER = "*****************************************************************";\r
+\r
+       public static final String BORDER2 = "#################################################################";\r
 \r
        public static final String FEDERATION_USER = "$gitblit";\r
 \r
index 8c66ce59c8031649211b5678398c9f2c88bc76e2..60687d44ea5d535465da05426555d820ee10a9b7 100644 (file)
@@ -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
index 0a3f6631912d0c1fc53a9f76b31469a88ace5f72..d24a06db9814fcfdc21432c61b257cfe3e7c414f 100644 (file)
@@ -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("");
+                       }
+               }
+       }
 }
index 19943d717e7477bb3bbaf2aec0440196bd719535..67b1d68fdccf526316789ae49de0cf5ef62e08e2 100644 (file)
@@ -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);