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

Add dispatcher event for audit log #28611

Merged
merged 1 commit into from
Aug 8, 2017
Merged

Add dispatcher event for audit log #28611

merged 1 commit into from
Aug 8, 2017

Conversation

sharidas
Copy link
Contributor

@sharidas sharidas commented Aug 8, 2017

Adding a dispatcher event to log unshare
event done by the recipient.

Signed-off-by: Sujith H sharidasan@owncloud.com

Description

This change helps to dispatch the unshare event triggered by recipient user.

Related Issue

Motivation and Context

This helps to trigger unshare event triggered by recipient user.

How Has This Been Tested?

  • Create two users admin and user1
  • Create folder test and file sampletext.txt under user admin
  • Share test and sampletext.txt to user user1
  • As user1 unshare test folder and file sampletext.txt
    Below are the logs obtained:
{"reqId":"1DRPazRmtEL4aBXXeJU3","level":1,"time":"2017-08-08T06:37:08+00:00","remoteAddr":"127.0.0.1","user":"user1","app":"admin_audit","method":"DELETE","url":"\/testing\/remote.php\/dav\/files\/user1\/test","message":"user <user1>, displayName <user1> unshared folder \/test from user admin, owner path: \/admin\/files\/test [CLIENT_IP: 127.0.0.1] [USER_AGENT: Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/60.0.3112.90 Safari\/537.36]"}

{"reqId":"PIShxuF0agZxrQIRFzwv","level":1,"time":"2017-08-08T06:37:10+00:00","remoteAddr":"127.0.0.1","user":"user1","app":"admin_audit","method":"DELETE","url":"\/testing\/remote.php\/dav\/files\/user1\/sampletest.txt","message":"user <user1>, displayName <user1> unshared file \/sampletest.txt from user admin, owner path: \/admin\/files\/sampletest.txt [CLIENT_IP: 127.0.0.1] [USER_AGENT: Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/60.0.3112.90 Safari\/537.36]"}

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Adding a dispatcher event to log unshare
event done by the recipient.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
@@ -870,6 +870,13 @@ public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) {
$hookParams['itemTarget'] = $hookParams['fileTarget'];
$hookParams['unsharedItems'] = [$hookParams];
\OC_Hook::emit('OCP\Share', 'post_unshareFromSelf', $hookParams);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

grep-ing through the source, I couldn't find connect for post_unshareFromSelf being used. One more reference is found in the core https://github.com/owncloud/core/blob/master/lib/private/Share/Share.php#L1101 .

Copy link
Contributor

Choose a reason for hiding this comment

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

This is because it was missing and just got added recently in #28401

Copy link
Contributor

@PVince81 PVince81 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 👍

@sharidas sharidas merged commit 7df3140 into master Aug 8, 2017
@DeepDiver1975 DeepDiver1975 deleted the unshare-action-log branch August 11, 2017 22:52
@sharidas
Copy link
Contributor Author

Backport stable10: #29851

@lock
Copy link

lock bot commented Aug 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants