-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 passwordEnabled field to postHookData #28822
Conversation
lib/private/Share20/Manager.php
Outdated
@@ -644,6 +644,7 @@ public function createShare(\OCP\Share\IShare $share) { | |||
'shareWith' => $share->getSharedWith(), | |||
'itemTarget' => $share->getTarget(), | |||
'fileTarget' => $share->getTarget(), | |||
'passwordDisabled'=> $share->getPassword(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this pass the password string instead of a boolean ?
call it "passwordEnabled" and set it to true if a password is set instead
23828c5
to
56d5241
Compare
Updated the PR to return true/false if password is enabed/disabled. |
56d5241
to
f6a814a
Compare
lib/private/Share20/Manager.php
Outdated
@@ -644,6 +644,7 @@ public function createShare(\OCP\Share\IShare $share) { | |||
'shareWith' => $share->getSharedWith(), | |||
'itemTarget' => $share->getTarget(), | |||
'fileTarget' => $share->getTarget(), | |||
'passwordEnabled'=> !is_null($share->getPassword()) ? true : false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it always null or can it sometimes be empty string after clearing ? please check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I replace is_null
with empty
then also it's working. I have verified it by creating public link with password and creating public link without password.
When the password field is cleared after set the hook related to that is https://github.com/owncloud/core/blob/master/lib/private/Share20/Manager.php#L733 post_update_password
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with empty()
will be when someone sets the share password to "0". PHP is very annoying.
97b7e07
to
b34a5d3
Compare
lib/private/Share20/Manager.php
Outdated
@@ -644,6 +644,7 @@ public function createShare(\OCP\Share\IShare $share) { | |||
'shareWith' => $share->getSharedWith(), | |||
'itemTarget' => $share->getTarget(), | |||
'fileTarget' => $share->getTarget(), | |||
'passwordEnabled' => (!is_null($share->getPassword()) and ($share->getPassword() !== '')) ? true : false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for true : false
, it is implicitly boolean when you have a condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the issue.
5cec8fa
to
0bd8977
Compare
Add passwordEnabled field to postHookData A boolean value which help us know if password is provided during share creation or not. Signed-off-by: Sujith H <[email protected]>
0bd8977
to
7b1c8c8
Compare
Backport to stable10 of this PR: #28827 |
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. |
Add passwordDisabled field to postHookData
Signed-off-by: Sujith H [email protected]
Description
Adding additional parameter passwordDisabled to the postHookData. This data would help us to determine if password is enabled for the share or not while creating the share.
Related Issue
Motivation and Context
This would help us know if the share was created with password or not.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: