add locationGroup to tenant
This commit is contained in:
parent
932657c2b2
commit
38c6a32114
@ -93,14 +93,39 @@ object Auth {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (e: Exception){
|
} catch (e: Exception) {
|
||||||
logger.warn("Exception in syncing plants", e)
|
logger.warn("Exception in syncing plants", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
return AuthUser(
|
return AuthUser(
|
||||||
userName = userId, tenant = tenant, roles = roles, token = authToken, expiry = LocalDateTime.from(date.toInstant().atZone(ZoneId.systemDefault())), plantIds = plantIds
|
userName = userId,
|
||||||
|
tenant = getTenantWithCompany(userId, tenant),
|
||||||
|
roles = roles,
|
||||||
|
token = authToken,
|
||||||
|
expiry = LocalDateTime.from(date.toInstant().atZone(ZoneId.systemDefault())),
|
||||||
|
plantIds = plantIds
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getTenantWithCompany(userId: String, tenant: String): String {
|
||||||
|
try {
|
||||||
|
HttpClients.createDefault().use { h ->
|
||||||
|
//sync plant's from rmc to here, just name and id
|
||||||
|
|
||||||
|
h.execute(HttpGet("${appConfig.integrationRmc()}/tenant?id=${userId}")).use { r ->
|
||||||
|
if (r.statusLine.statusCode == 200) {
|
||||||
|
|
||||||
|
return "$tenant${EntityUtils.toString(r.entity)}"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.warn("Exception in syncing plants", e)
|
||||||
|
}
|
||||||
|
return tenant
|
||||||
|
}
|
||||||
|
|
||||||
fun keys(ctx: Context) {
|
fun keys(ctx: Context) {
|
||||||
ctx.json(Session.jwk())
|
ctx.json(Session.jwk())
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user