editorial-permissions-client


License

License

MIT
Categories

Categories

CLI User Interface
GroupId

GroupId

com.gu
ArtifactId

ArtifactId

editorial-permissions-client_2.10
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

jar
Description

Description

editorial-permissions-client
editorial-permissions-client
Project URL

Project URL

https://github.com/guardian/editorial-permissions-client
Project Organization

Project Organization

com.gu
Source Code Management

Source Code Management

https://github.com/guardian/editorial-permissions-client

Download editorial-permissions-client_2.10

How to add to project

<!-- https://jarcasting.com/artifacts/com.gu/editorial-permissions-client_2.10/ -->
<dependency>
    <groupId>com.gu</groupId>
    <artifactId>editorial-permissions-client_2.10</artifactId>
    <version>0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.gu/editorial-permissions-client_2.10/
implementation 'com.gu:editorial-permissions-client_2.10:0.2'
// https://jarcasting.com/artifacts/com.gu/editorial-permissions-client_2.10/
implementation ("com.gu:editorial-permissions-client_2.10:0.2")
'com.gu:editorial-permissions-client_2.10:jar:0.2'
<dependency org="com.gu" name="editorial-permissions-client_2.10" rev="0.2">
  <artifact name="editorial-permissions-client_2.10" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.gu', module='editorial-permissions-client_2.10', version='0.2')
)
libraryDependencies += "com.gu" % "editorial-permissions-client_2.10" % "0.2"
[com.gu/editorial-permissions-client_2.10 "0.2"]

Dependencies

compile (6)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.4
com.amazonaws : aws-java-sdk jar 1.9.29
com.typesafe.akka : akka-actor_2.10 jar 2.3.4
com.typesafe.akka : akka-agent_2.10 jar 2.3.4
com.typesafe.akka : akka-slf4j_2.10 jar 2.3.4
net.liftweb : lift-json_2.10 jar 2.6

test (2)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.8.5
org.scalatest : scalatest_2.10 jar 2.2.4

Project Modules

There are no modules declared in this project.

editorial-permissions-client

NB: the client library has been moved to the main Permission code-base. Please make any further updates there. https://github.com/guardian/permissions

Scala Client library for the Guardian's Editorial Permissions service.

Usage

Add the following dependency to your build.sbt

libraryDependencies += "com.gu" %% "editorial-permissions-client" % "0.2"

Then mixin the PermissionsProvider trait to configure integration with PermissionsConfig and all your application Permissions by defining val all: Seq[Permission].

For example:

import com.gu.editorial.permissions.client._

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

object MyPermissions extends PermissionsProvider {
  val app = "composer"

  implicit def config = PermissionsConfig(
    app = app,
    all = all
  )

  val LaunchContent = Permission("launch_content", app, PermissionGranted)

  val all = Seq(LaunchContent)
}

object Example {

  implicit def permissionsUser: PermissionsUser =
    PermissionsUser("[email protected]")

  MyPermissions.get(MyPermissions.LaunchContent).map {
    case PermissionGranted => "I'm in!"
    case PermissionDenied => ":("
  }

  val myPerms: Future[PermissionsMap] = MyPermissions.list
}

Contributing

Releasing

Ensure tests pass before a release.

sbt clean test

Then release using:

sbt release

Note you will need:

com.gu

The Guardian

The source code of the world's leading liberal voice

Versions

Version
0.2
0.1.1
0.1