diff options
author | Vlad Uspensky <v.uspenskiy@icloud.com> | 2017-11-02 20:40:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 20:40:31 -0700 |
commit | aedb5274932db81a32f9d89938636df114dc9a44 (patch) | |
tree | 13a0a8a51f477a4fce2bb8f4d5cd8248de54a73b /src/main/scala/xyz/driver/pdsuidomain/services/DocumentService.scala | |
parent | 4583af5213b9f7b1e8a06f58321813556763f2d1 (diff) | |
parent | 5515c834853cbe3ce60460a4819a94805cfe24f7 (diff) | |
download | rest-query-aedb5274932db81a32f9d89938636df114dc9a44.tar.gz rest-query-aedb5274932db81a32f9d89938636df114dc9a44.tar.bz2 rest-query-aedb5274932db81a32f9d89938636df114dc9a44.zip |
Merge pull request #59 from drivergroup/common-contextsv0.13.1
Using common request contexts and user objects
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/services/DocumentService.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/services/DocumentService.scala | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/DocumentService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/DocumentService.scala index 9338a59..a16ac9c 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/services/DocumentService.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/services/DocumentService.scala @@ -2,7 +2,8 @@ package xyz.driver.pdsuidomain.services import java.time.LocalDateTime -import xyz.driver.pdsuicommon.auth.AuthenticatedRequestContext +import xyz.driver.core.rest.AuthorizedServiceRequestContext +import xyz.driver.entities.users.AuthUserInfo import xyz.driver.pdsuicommon.db._ import xyz.driver.pdsuicommon.domain.LongId import xyz.driver.pdsuicommon.error.DomainError @@ -32,7 +33,8 @@ object DocumentService { case object AuthorizationError extends GetByIdReply with DomainError.AuthorizationError with DefaultAccessDeniedError - final case class CommonError(userMessage: String)(implicit requestContext: AuthenticatedRequestContext) + final case class CommonError(userMessage: String)( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]) extends GetByIdReply with DomainError implicit def toPhiString(reply: GetByIdReply): PhiString = reply match { @@ -106,31 +108,40 @@ trait DocumentService { import DocumentService._ - def getById(id: LongId[Document])(implicit requestContext: AuthenticatedRequestContext): Future[GetByIdReply] + def getById(id: LongId[Document])( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[GetByIdReply] def getAll(filter: SearchFilterExpr = SearchFilterExpr.Empty, sorting: Option[Sorting] = None, pagination: Option[Pagination] = None)( - implicit requestContext: AuthenticatedRequestContext): Future[GetListReply] + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[GetListReply] - def create(draftDocument: Document)(implicit requestContext: AuthenticatedRequestContext): Future[CreateReply] + def create(draftDocument: Document)( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[CreateReply] def update(orig: Document, draft: Document)( - implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] - def delete(id: LongId[Document])(implicit requestContext: AuthenticatedRequestContext): Future[DeleteReply] + def delete(id: LongId[Document])( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[DeleteReply] - def start(orig: Document)(implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + def start(orig: Document)( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] - def submit(orig: Document)(implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + def submit(orig: Document)( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] - def restart(orig: Document)(implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + def restart(orig: Document)( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] - def flag(orig: Document)(implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + def flag(orig: Document)(implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] - def resolve(orig: Document)(implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + def resolve(orig: Document)( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] - def unassign(orig: Document)(implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + def unassign(orig: Document)( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] - def archive(orig: Document)(implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + def archive(orig: Document)( + implicit requestContext: AuthorizedServiceRequestContext[AuthUserInfo]): Future[UpdateReply] } |