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

Commit

Permalink
Using request tenant info from common-utils to filter
Browse files Browse the repository at this point in the history
  • Loading branch information
akbhatta committed Nov 25, 2020
1 parent 2948a9b commit fdbd305
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions reports-scheduler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compile "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
compile "${group}:common-utils:${version}"
compileOnly "${group}:opendistro-job-scheduler-spi:${opendistroVersion}.0" // TODO: use ${version} when available
compile "${group}:common-utils:${opendistroVersion}.1"
compileOnly "${group}:opendistro-job-scheduler-spi:${opendistroVersion}.0"
compile group: 'com.google.guava', name: 'guava', version: '15.0'
testImplementation(
'org.assertj:assertj-core:3.16.1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal object UserAccessManager {
private const val ROLE_TAG = "Role:"
private const val BACKEND_ROLE_TAG = "BERole:"
private const val ALL_ACCESS_ROLE = "all_access"
private const val KIBANA_SERVER_USER = "kibanaserver"
private const val KIBANA_SERVER_USER = "kibanaserver" // TODO: Change it to background user when created.
private const val PRIVATE_TENANT = "__user__"
const val DEFAULT_TENANT = ""

Expand Down Expand Up @@ -92,7 +92,10 @@ internal object UserAccessManager {
* Get tenant info from user object.
*/
fun getUserTenant(user: User?): String {
return DEFAULT_TENANT // TODO: extract from user object
return when (val requestedTenant = user?.requestedTenant) {
null -> DEFAULT_TENANT
else -> requestedTenant
}
}

/**
Expand Down

0 comments on commit fdbd305

Please sign in to comment.