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 vouching #1257

Merged
merged 6 commits into from
Dec 4, 2023
Merged

Add vouching #1257

merged 6 commits into from
Dec 4, 2023

Conversation

ysangkok
Copy link
Member

Fixes #1093.

Vouching allows new users to get added to the uploaders group by way of other people "vouching" for then. This should alleviate privileged Hackage users, since they were previously the only people that could add people to the uploaders group.

Tagging @david-christiansen since we discussed this.

Vouching allows new users to get added to the uploaders group by way of
other people "vouching" for then. This should alleviate privileged
Hackage users, since they were previously the only people that could add
people to the uploaders group.
Copy link

@jappeace jappeace left a comment

Choose a reason for hiding this comment

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

doesn't hackage do tests either? LIke I'd expect at least all happy paths to have some integration test

src/Distribution/Server/Features/Vouch.hs Outdated Show resolved Hide resolved
src/Distribution/Server/Features/Vouch.hs Outdated Show resolved Hide resolved
src/Distribution/Server/Features/Vouch.hs Outdated Show resolved Hide resolved
vouchee <- lookupUserName =<< userNameInPath dpath
vouchersForVoucher <- queryState vouchState $ GetVouchesFor voucher
existingVouchers <- queryState vouchState $ GetVouchesFor vouchee
case join $ judge ugroup now vouchee vouchersForVoucher existingVouchers voucher of
Copy link

Choose a reason for hiding this comment

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

Why pawn off all checks to a judge function to immediatly unwrap them again?

Copy link
Member Author

@ysangkok ysangkok Oct 16, 2023

Choose a reason for hiding this comment

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

This is primarily such that the logic can be tested. I added tests in the commit 3c82d01.

src/Distribution/Server/Features/Vouch.hs Outdated Show resolved Hide resolved
src/Distribution/Server/Features/Vouch.hs Outdated Show resolved Hide resolved
newUTCTime = timestamp {utctDayTime = secondsToDiffTime truncated}
pure . toUTF8LBS . prettyHtmlFragment . li . stringToHtml $ name <> " vouched on " <> formatShow iso8601Format newUTCTime

initVouchFeature :: ServerEnv -> IO (UserFeature -> UploadFeature -> IO VouchFeature)
Copy link

Choose a reason for hiding this comment

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

Is this callback setup required? can't you immediatly chug in UserFeatue and UploadFeature?

eg

initVouchFeature :: ServerEnv -> UserFeature -> UploadFeature -> IO VouchFeature

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the pattern used across the codebase, look in Server/Features.hs (the use site) so see how it's used all over. I don't object to your observation but I think we should change it consistently in a different PR if it needs to change.

Choose a reason for hiding this comment

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

it's fine, it's a minor style nitpick :)

Copy link

@jappeace jappeace left a comment

Choose a reason for hiding this comment

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

You've my approval although I know little about hackage

@gbaz
Copy link
Contributor

gbaz commented Oct 23, 2023

I'll give this a real look soon and edit the text a bit as well, but just as a note i think the right name for the text is endorsement, following arxiv https://info.arxiv.org/help/endorsement.html

Of course in the code itself we can keep vouch to not cause a bunch of renames :-P

@ysangkok
Copy link
Member Author

ysangkok commented Dec 2, 2023

@gbaz I added commits to add an e-mail notification when the endorsements have been received and to rename to user-facing pages to refer to 'endorsements'.

@gbaz gbaz merged commit 294110b into master Dec 4, 2023
3 of 10 checks passed
@andreasabel andreasabel deleted the janus/vouch branch December 5, 2023 05:52
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.

Allow Good Status Uploaders to approve other uploaders.
3 participants