in reports-scheduler/src/main/kotlin/org/opensearch/reportsscheduler/security/UserAccessManager.kt [35:53]
fun validateUser(user: User?) {
if (isUserPrivateTenant(user) && user?.name == null) {
Metrics.REPORT_PERMISSION_USER_ERROR.counter.increment()
throw OpenSearchStatusException(
"User name not provided for private tenant access",
RestStatus.FORBIDDEN
)
}
if (PluginSettings.isRbacEnabled()) {
// backend roles must be present
if (user?.backendRoles.isNullOrEmpty()) {
Metrics.REPORT_PERMISSION_USER_ERROR.counter.increment()
throw OpenSearchStatusException(
"User doesn't have backend roles configured. Contact administrator.",
RestStatus.FORBIDDEN
)
}
}
}