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 query param to delete after file stream #147

Merged
merged 1 commit into from
May 16, 2024
Merged

Conversation

MrCreosote
Copy link
Member

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.

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.
@MrCreosote MrCreosote requested a review from Xiangs18 May 9, 2024 02:38
Copy link

codecov bot commented May 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.65%. Comparing base (790928a) to head (44bf972).
Report is 1 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

@Xiangs18
Copy link
Collaborator

What made you to add this feature?

@MrCreosote
Copy link
Member Author

https://kbase.slack.com/archives/C05SSJT13BN/p1714507088631629

if err != nil {
return false, err
}
if user == nil || (user.GetUserName() != node.Owner.AccountName && !user.IsAdmin()) {
Copy link
Collaborator

@Xiangs18 Xiangs18 May 16, 2024

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.

Copy link
Member Author

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

Copy link
Collaborator

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

Copy link
Member Author

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

Copy link
Collaborator

@Xiangs18 Xiangs18 May 16, 2024

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.

@MrCreosote MrCreosote merged commit 0cc56c5 into develop May 16, 2024
12 checks passed
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

Successfully merging this pull request may close these issues.

2 participants