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

admin: Add unban endpoint. #479

Merged
merged 3 commits into from
Jul 14, 2020
Merged

admin: Add unban endpoint. #479

merged 3 commits into from
Jul 14, 2020

Conversation

JoeGruffins
Copy link
Member

No description provided.

@chappjc chappjc added the server server components label Jun 18, 2020
@JoeGruffins JoeGruffins force-pushed the unban branch 2 times, most recently from 29b78a0 to 8e4a861 Compare July 5, 2020 02:12
@JoeGruffins JoeGruffins marked this pull request as ready for review July 5, 2020 02:39
server/dex/dex.go Outdated Show resolved Hide resolved
@JoeGruffins JoeGruffins force-pushed the unban branch 2 times, most recently from b114a4c to ff63646 Compare July 7, 2020 04:34
server/admin/api.go Outdated Show resolved Hide resolved
server/admin/api.go Outdated Show resolved Hide resolved
server/admin/api.go Outdated Show resolved Hide resolved
server/auth/auth.go Outdated Show resolved Hide resolved
server/auth/auth.go Outdated Show resolved Hide resolved
server/auth/auth.go Outdated Show resolved Hide resolved
Comment on lines 35 to 42
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
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah.

server/db/interface.go Outdated Show resolved Hide resolved
Copy link
Member

@chappjc chappjc left a 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...

@chappjc chappjc merged commit 868444e into decred:master Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server server components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants