summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-08-20 17:08:18 +0200
committerGitHub <noreply@github.com>2018-08-20 17:08:18 +0200
commit37869d9b2f7bf5e9f3779ccd344114649ce459c1 (patch)
tree336dc41c77bb07406537379339aa8f780f344dc0 /core
parent080572993e891a76721f4f7a7b76c85bc0e4c65d (diff)
parent3f790bb85b3544680f4af2e3e005d736a5aff8a0 (diff)
downloadnextcloud-server-37869d9b2f7bf5e9f3779ccd344114649ce459c1.tar.gz
nextcloud-server-37869d9b2f7bf5e9f3779ccd344114649ce459c1.zip
Merge pull request #10628 from nextcloud/feature/10154/app-directory-permission-check
Adds a permission check for app directories
Diffstat (limited to 'core')
-rw-r--r--core/js/setupchecks.js17
-rw-r--r--core/js/tests/specs/setupchecksSpec.js80
2 files changed, 86 insertions, 11 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 93072981e99..13e351445e9 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -316,6 +316,23 @@
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
+
+ if(data.appDirsWithDifferentOwner.length > 0) {
+ var appDirsWithDifferentOwner = data.appDirsWithDifferentOwner.reduce(
+ function(appDirsWithDifferentOwner, directory) {
+ return appDirsWithDifferentOwner + '<li>' + directory + '</li>';
+ },
+ ''
+ );
+ messages.push({
+ msg: t('core', 'Some app directories are owned by a different user than the web server one. ' +
+ 'This may be the case if apps have been installed manually. ' +
+ 'Check the permissions of the following app directories:')
+ + '<ul>' + appDirsWithDifferentOwner + '</ul>',
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
+ });
+ }
+
} else {
messages.push({
msg: t('core', 'Error occurred while checking server setup'),
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
index e22fb35102e..30c2ad9c5f0 100644
--- a/core/js/tests/specs/setupchecksSpec.js
+++ b/core/js/tests/specs/setupchecksSpec.js
@@ -170,7 +170,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -217,7 +218,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -265,7 +267,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -311,7 +314,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -355,7 +359,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -368,6 +373,53 @@ describe('OC.SetupChecks tests', function() {
});
});
+ it('should return a warning if there are app directories with wrong permissions', function(done) {
+ var async = OC.SetupChecks.checkSetup();
+
+ suite.server.requests[0].respond(
+ 200,
+ {
+ 'Content-Type': 'application/json',
+ },
+ JSON.stringify({
+ hasFileinfoInstalled: true,
+ isGetenvServerWorking: true,
+ isReadOnlyConfig: false,
+ hasWorkingFileLocking: true,
+ hasValidTransactionIsolationLevel: true,
+ suggestedOverwriteCliURL: '',
+ isUrandomAvailable: true,
+ securityDocs: 'https://docs.owncloud.org/myDocs.html',
+ serverHasInternetConnection: true,
+ isMemcacheConfigured: true,
+ forwardedForHeadersWorking: true,
+ isCorrectMemcachedPHPModuleInstalled: true,
+ hasPassedCodeIntegrityCheck: true,
+ isOpcacheProperlySetup: true,
+ hasOpcacheLoaded: true,
+ isSettimelimitAvailable: true,
+ hasFreeTypeSupport: true,
+ missingIndexes: [],
+ outdatedCaches: [],
+ cronErrors: [],
+ cronInfo: {
+ diffInSeconds: 0
+ },
+ appDirsWithDifferentOwner: [
+ '/some/path'
+ ]
+ })
+ );
+
+ async.done(function( data, s, x ){
+ expect(data).toEqual([{
+ msg: 'Some app directories are owned by a different user than the web server one. This may be the case if apps have been installed manually. Check the permissions of the following app directories:<ul><li>/some/path</li></ul>',
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
+ }]);
+ done();
+ });
+ });
+
it('should return an error if the forwarded for headers are not working', function(done) {
var async = OC.SetupChecks.checkSetup();
@@ -399,7 +451,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -443,7 +496,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -508,7 +562,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -553,7 +608,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -598,7 +654,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);
@@ -643,7 +700,8 @@ describe('OC.SetupChecks tests', function() {
cronErrors: [],
cronInfo: {
diffInSeconds: 0
- }
+ },
+ appDirsWithDifferentOwner: []
})
);