UpdateAuthModifier
public final class UpdateAuthModifier<
A: UpdateEndpoint,
U: CorvusModelAuthenticatable>:
AuthModifier<A, U>, UpdateEndpoint
A class that wraps a Update component which utilizes an .auth()
modifier. That allows Corvus to chain modifiers, as it gets treated as any
other struct conforming to UpdateAuthModifier. Requires an object U that
represents the user to authorize.
-
A method which checks if the old value and the updated value both belong to the user making the request.
Throws
AnAborterror if an item is not found.Declaration
Swift
override public func handler(_ req: Request) throws -> EventLoopFuture<Element>Parameters
reqAn incoming
Request.Return Value
An
EventLoopFuturecontaining an eagerloaded value as defined byElement. If authorization fails or a user is not found, HTTP.unauthorizedand.notFoundare thrown respectively.
UpdateAuthModifier Class Reference