owncloud / data_exporter

Export/Import for ownCloud user data
GNU General Public License v2.0
7 stars 5 forks source link

Fix isAppEnabledForUser check #206

Closed phil-davis closed 2 years ago

phil-davis commented 2 years ago

Description

1) The ExportUser command calls isAppEnabledForUser but passes just the string value "uid" (the username). But the core method expects to be passed an OCP/IUser object.

Up to now, this error was not noticed. Tests had to call isAppEnabledForUser in an environment where there were combinations of apps whitelisted for various groups - that was the only situation when the parameter passed in was actually used as an IUser object.

Core PR https://github.com/owncloud/core/pull/40257 was merged yesterday. That added more code to isAppEnabledForUser, and that meant that the error in the data_exporter app is now causing test failures.

This PR fixes the calls. It is all backward-compatible with previous versions of oC10 core - so there is no need to increase the core min-version.

2) while I was trying export and import commands, I noticed that they always exit with "0" (success) status at the command line. The 2nd commit adds code to make them exit with status 1 in case of error.

Related Issue

Fixes #205

How Has This Been Tested?

Local run of test scenario:

$ make test-acceptance-cli BEHAT_FEATURE=tests/acceptance/features/cliDataExporter/export.feature:9

It fails before the code change, and passes after the code change.

Types of changes

Checklist:

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication