Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Made store non-private so that we can check if the store is empty or …
Browse files Browse the repository at this point in the history
…not. To allow clients to check if permissions is accessible in their healthcheck.
  • Loading branch information
Jenny Sivapalan committed Jul 15, 2016
1 parent 4c1e71a commit e10f5cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -14,7 +14,7 @@ trait PermissionsProvider {

def config: PermissionsConfig

private val store: PermissionsStore = new PermissionsStore(config)
val store: PermissionsStore = new PermissionsStore(config)

def get(perm: Permission)(implicit user: PermissionsUser): Future[PermissionAuthorisation] =
store.get(perm).recover {
Expand Down
Expand Up @@ -57,6 +57,7 @@ class PermissionsStore(config: PermissionsConfig, provider: Option[PermissionsSt

trait PermissionsStoreProvider {
val store: Agent[PermissionsStoreModel]
def storeIsEmpty: Boolean
}


Expand All @@ -72,6 +73,13 @@ private[client] final class PermissionsStoreFromS3(config: PermissionsConfig,

val store: Agent[PermissionsStoreModel] = Agent(PermissionsStoreModel.empty)

def storeIsEmpty = {
store.get() match {
case PermissionsStoreModel.empty => true
case s: PermissionsStoreModel => false
}
}

private val s3 = s3Client.getOrElse {
new AmazonS3(creds = config.awsCredentials, region = config.s3Region)
}
Expand Down

0 comments on commit e10f5cd

Please sign in to comment.