Skip to content

Commit

Permalink
Merge pull request #83 from owncloud/unstuckUserWhenServerIssue
Browse files Browse the repository at this point in the history
logout user automatically, when manual logout is impossible
  • Loading branch information
individual-it authored Feb 9, 2024
2 parents 95edd79 + a9f5611 commit 0d1c9be
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

## Summary
* Bugfix - fixed a bug where a user could end up with an unusable file-picker [#83](https://github.com/owncloud/moodle-repository_ocis/pull/83)

## Details

* Bugfix - fixed a bug where a user could end up with an unusable file-picker [#83](https://github.com/owncloud/moodle-repository_ocis/pull/83)
We have fixed a bug where when a user, with a ocis-token, looses access to ocis, would only see an error message and could not use the file-picker nor could log-out.
The solution was to log-out the user automatically in those cases.

https://github.com/owncloud/moodle-repository_ocis/issues/80
https://github.com/owncloud/moodle-repository_ocis/pull/83

# Changelog for [1.0.0-rc.1] (2024-01-18)

## Summary
Expand Down
14 changes: 13 additions & 1 deletion classes/ocis_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ private function get_drives(): array {
);
}
} catch (HttpException $e) {
$this->oauth2client->log_out();
throw new moodle_exception(
'could_not_connect_error',
'repository_ocis',
Expand All @@ -256,21 +257,32 @@ private function get_drives(): array {
$e->getTraceAsString()
);
} catch (UnauthorizedException $e) {
$this->oauth2client->log_out();
throw new moodle_exception(
'unauthorized_error',
'unauthorized_error_after_logout',
'repository_ocis',
'',
null,
$e->getTraceAsString()
);
} catch (InternalServerErrorException $e) {
$this->oauth2client->log_out();
throw new moodle_exception(
'internal_server_error',
'repository_ocis',
'',
null,
$e->getTraceAsString()
);
} catch (\Exception $e) {
$this->oauth2client->log_out();
throw new moodle_exception(
'unrecoverable_server_error',
'repository_ocis',
'',
null,
$e->getTraceAsString()
);
}

if (empty($drives)) {
Expand Down
4 changes: 3 additions & 1 deletion lang/en/repository_ocis.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
$string['too_early_error'] = 'This file is still processed by the ownCloud Infinite Scale server. Please try again later.';
$string['could_not_connect_error'] = 'Could not connect to ownCloud Infinite Scale server.';
$string['internal_server_error'] = 'The ownCloud Infinite Scale server has an internal problem. Please try again later.';
$string['unauthorized_error'] = 'Authorization to ownCloud Infinite Scale server failed. Please try to logout of the repository and login again' .
$string['unauthorized_error'] = 'Authorization to ownCloud Infinite Scale server failed. Please try to logout of the repository and login again.';
$string['unauthorized_error_after_logout'] = 'Authorization to ownCloud Infinite Scale server failed. Please try to login again.';
$string['unrecoverable_server_error'] = 'The ownCloud Infinite Scale server ran into a problem. Please try to login again.';
$string['webfinger_error'] = 'Could not get user-information from webfinger service.';
$string['personal_drive'] = 'Personal';
$string['shares_drive'] = 'Shares';

0 comments on commit 0d1c9be

Please sign in to comment.