final class LinkService(links: LinkStore, groups: GroupStore, grants: GrantStore, db: Transactor, resources: Resource=>DBIO[Option[String]] = ..., report: Throwable=>IO[Unit] = ..., guesses: Int = ..., window: FiniteDuration = ..., affected: Affected=>IO[Unit] = ..., guests: Option[AuthService] = ..., strangerGuesses: Int = ...)
A service that previews and follows invite links. A link to a group joins it; a link to a resource grants its access, never lowering what the follower holds. The host makes links to its resources through LinkStore.
Codes are short enough to guess, so a user who tries too many that lead nowhere within window finds every code leads nowhere until it passes. Strangers following links as guests share one allowance, and once it is spent are told guests are paused. The counts are kept in memory.
Value parameters
affected
The hook told whom a followed link concerns (see Affected).
db
The database the stores use.
grants
The store of grants.
groups
The store of groups.
guesses
The number of codes leading nowhere one user may try within window.
guests
The service that makes guests, letting strangers follow links as one, or None. Its AuthPolicy.guests must allow them too.
links
The store of links.
report
The handler of failures whose detail must not reach the client.
resources
The lookup of a resource's name that locks its row until the transaction ends, yielding None for a missing resource. It runs in the transaction following a link, so the access granted cannot outlive the resource (see GrantStore.revokeOver). The default knows no resources.
strangerGuesses
The number of codes leading nowhere all guests together may try within window.
window
The time a code that led nowhere counts against its tryer.
Follows an invite link as a new guest: makes the guest, gives them what the link leads to and signs them in, all at once, so a link leading nowhere makes nobody. Refused unless welcoming.
Follows an invite link as a new guest: makes the guest, gives them what the link leads to and signs them in, all at once, so a link leading nowhere makes nobody. Refused unless welcoming.
Value parameters
code
The link's code, in any case.
name
The name the guest gave, which becomes their username.
Attributes
Returns
An answer with the guest, the link's target and the session's cookie, or a refusal.