-
Notifications
You must be signed in to change notification settings - Fork 3
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 query param to delete after file stream #147
Conversation
This is useful for temporary nodes where once the user has the data, the node is no longer needed, and the link to the data is expected to work once.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #147 +/- ##
===========================================
+ Coverage 90.49% 90.65% +0.16%
===========================================
Files 14 14
Lines 1998 2033 +35
===========================================
+ Hits 1808 1843 +35
Misses 157 157
Partials 33 33 ☔ View full report in Codecov by Sentry. |
What made you to add this feature? |
if err != nil { | ||
return false, err | ||
} | ||
if user == nil || (user.GetUserName() != node.Owner.AccountName && !user.IsAdmin()) { |
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.
L571, if any of condition in () in False
, then the error will not be raised. This does not sound right, unless I am missing something.
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 parentheses say "If the user is not the node owner and the user is not an admin, raise an error", which is the behavior we want
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.
I see. So either be the node owner or has admin right is good
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.
Right. You could do
if user == node.owner or user.isAdmin() {
//pass
} else {
throw NewError(...)
which would have equivalent logic, but that's just wasted space
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 less restricted that I thought. But it makes sense.
yeah, it makes more sense. Admin can have access to everything, and I get access if I am the owner.
This is useful for temporary nodes where once the user has the data, the node is no longer needed, and the link to the data is expected to work once.