Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$testdelete setting in client does not respect plugin config, delete permissions checks may be outdated #645

Open
matthewhilton opened this issue Oct 14, 2024 · 0 comments

Comments

@matthewhilton
Copy link
Contributor

matthewhilton commented Oct 14, 2024

In the client class, there is a flag $testdelete, which if true it tests deleting objects in test_permissions which is run/displayed in the admin settings.

However, it does not follow the Delete external objects setting, which means for example if I have Delete external objects set to no, it will still try and delete but fail because I didn't give it delete permissions.

In the Digitalocean client class, this is just plainly disabled for an unknown reason, see:

Furthermore, some classes e.g. the azure storage class do not even consider the $testdelete flag at all, however mysteriously it does not appear to fail when not given delete permissions (perhaps the error code changed?):

try {
$result = $this->client->deleteBlob($this->container, 'permissions_check_file');
$permissions->messages[get_string('settings:deletesuccess', 'tool_objectfs')] = 'warning';
$permissions->success = false;
} catch (\MicrosoftAzure\Storage\Common\Exceptions\ServiceException $e) {
$errorcode = $this->get_body_error_code($e);
// Something else went wrong.
if ($errorcode !== 'AuthorizationPermissionMismatch') {
$details = $this->get_exception_details($e);
$permissions->messages[get_string('settings:deleteerror', 'tool_objectfs') . $details] = 'notifyproblem';

I believe a similar problem might exist with the S3 class, where it is not correctly testing the delete permissions so its always trying to test but even if it can't delete it doesn't trigger an error when it should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant