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

feat: include file id in audit logs #44871

Merged
merged 1 commit into from Apr 30, 2024

Conversation

yemkareems
Copy link
Contributor

@yemkareems yemkareems commented Apr 17, 2024

Summary

  • Few logs are changed after this implementation. Find attached is the file of logs before and after this implementation
    nc.logs.txt

Checklist

@yemkareems yemkareems added enhancement 3. to review Waiting for reviews labels Apr 17, 2024
@yemkareems yemkareems added this to the Nextcloud 30 milestone Apr 17, 2024
@yemkareems yemkareems self-assigned this Apr 17, 2024
Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall

apps/admin_audit/lib/Actions/Files.php Outdated Show resolved Hide resolved
apps/admin_audit/lib/Actions/Files.php Outdated Show resolved Hide resolved
apps/admin_audit/lib/AppInfo/Application.php Outdated Show resolved Hide resolved
@szaimen
Copy link
Contributor

szaimen commented Apr 18, 2024

Sorry, don't feel confident enough to review this

@szaimen szaimen removed their request for review April 18, 2024 08:27
apps/admin_audit/lib/AppInfo/Application.php Outdated Show resolved Hide resolved
Comment on lines 197 to 220
} catch (InvalidPathException|NotFoundException $e) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should still log something, maybe even on error level, so that this is not missed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@come-nc logging the exception message as error in log file. I tried to delete a file that is already deleted from oc_filecache and also removed from data/admin/files/log.txt. I get a message in the UI saying "Delete file" action failed but i did not find it getting logged as a error message

@come-nc
Copy link
Contributor

come-nc commented Apr 22, 2024

Please also fix commit names, should not all start with feat:, see https://www.conventionalcommits.org/en/v1.0.0/
Would be good to use the opportunity to also squash them into something like 2 commits only, one for event refactor and one for adding id to logs.

@come-nc come-nc changed the title Feature/include file id in audit logs feat: include file id in audit logs Apr 22, 2024
Comment on lines 90 to 97

/**
* Log a error message with a log level of error
* @param string $text
*/
public function error(string $text): void {
$this->logger->error($text, ['app' => 'admin_audit']);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this method, it makes thing unnecessiraly convoluted.
Inject the loggen in the child class if possible, use \OCP\Server::get if not.

@yemkareems yemkareems force-pushed the feature/include-file-id-in-audit-logs branch 3 times, most recently from 6ed0835 to 977bf8e Compare April 29, 2024 09:53
@yemkareems yemkareems force-pushed the feature/include-file-id-in-audit-logs branch 2 times, most recently from bc3e830 to 710f11d Compare April 29, 2024 10:10
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the commit description:
Copie d'écran_20240429_132314

@yemkareems yemkareems force-pushed the feature/include-file-id-in-audit-logs branch from 710f11d to 7b0b54f Compare April 29, 2024 12:04
Signed-off-by: yemkareems <yemkareems@gmail.com>
@come-nc come-nc force-pushed the feature/include-file-id-in-audit-logs branch from 7b0b54f to 4d22880 Compare April 30, 2024 09:31
@yemkareems yemkareems merged commit 66aad43 into master Apr 30, 2024
157 checks passed
@yemkareems yemkareems deleted the feature/include-file-id-in-audit-logs branch April 30, 2024 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants