-
Notifications
You must be signed in to change notification settings - Fork 95
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
admin: Add unban endpoint. #479
Conversation
29b78a0
to
8e4a861
Compare
b114a4c
to
ff63646
Compare
server/db/driver/pg/accounts.go
Outdated
err := setRule(a.db, a.tables.accounts, aid, account.NoRule) | ||
if err != nil { | ||
// fatal unless 0 matching rows found. | ||
if !errors.Is(err, errNoRows) { | ||
a.fatalBackendErr(err) | ||
} | ||
return fmt.Errorf("error opening account %s: %v", aid, err) | ||
} | ||
return nil |
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.
Please factor out this into (a *Archiver).setAccountRule
and call it from both CloseAccount
and OpenAccount
or whatever we call it. You could even just call CloseAccount(aid, account.NoRule)
from OpenAccount
, but that might be confusing to read.
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.
You do still want the unexported setRule
function, correct?
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.
Yeah.
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.
Works well.
Only thing I'm wondering about pertains to the ban
route as the dex admin cannot ban if --anarchy
is enabled because of the check in (*AuthManager).Penalize
. This check prevents auto-bans when Penalize
is called from the Swapper and elsewhere, but I can still imagine needing to manually ban even if auto-ban is not enabled. Just something to investigate...
No description provided.