Skip to content

Instantly share code, notes, and snippets.

@benkolera
Created February 3, 2014 07:23
Show Gist options
  • Save benkolera/8779969 to your computer and use it in GitHub Desktop.
Save benkolera/8779969 to your computer and use it in GitHub Desktop.
def intent = {
case req @ GET(Path(Seg("admin" :: "accounts" :: rest ))) => req match {
case Session(session) if (session.get("username").nonEmpty) => Pass
case _ => req.respond(Unauthorized)
}
case req @ GET(Path(Seg("admin" :: "accounts" :: Nil))) =>
list(req)
case req @ GET(Path(Seg("admin" :: "accounts" :: "uncreated" :: Nil))) =>
uncreated(req)
case req @ GET(Path(Seg("admin" :: "accounts" :: id :: Nil))) =>
get(req, id)
case req @ POST(Path(Seg("admin" :: "accounts" :: id :: "create" :: Nil))) =>
create(req, id)
case req @ POST(Path(Seg("admin" :: "accounts" :: id :: "update" :: Nil))) =>
update(req, id)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment