JMAP Registry API implementation - part 11
This commit is contained in:
@@ -56,7 +56,7 @@ impl ClientRegistrationHandler for Server {
|
||||
let (_, access_token) = self.authenticate_headers(req, &session).await?;
|
||||
|
||||
// Validate permissions
|
||||
access_token.enforce_permission(Permission::OauthClientRegistration)?;
|
||||
access_token.enforce_permission(Permission::OAuthClientRegistration)?;
|
||||
access_token.tenant_id()
|
||||
} else {
|
||||
self.is_http_anonymous_request_allowed(&session.remote_ip)
|
||||
@@ -164,7 +164,7 @@ impl ClientRegistrationHandler for Server {
|
||||
.await
|
||||
.caused_by(trc::location!())?
|
||||
.build()
|
||||
.has_permission(Permission::OauthClientOverride)
|
||||
.has_permission(Permission::OAuthClientOverride)
|
||||
{
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ impl ManagementApi for Server {
|
||||
#[cfg(feature = "enterprise")]
|
||||
Some("tracing") if self.core.is_enterprise_edition() => {
|
||||
// Validate the access token
|
||||
access_token.enforce_permission(Permission::TracingLive)?;
|
||||
access_token.enforce_permission(Permission::LiveTracing)?;
|
||||
|
||||
// Issue a live telemetry token valid for 60 seconds
|
||||
Ok(JsonResponse::new(json!({
|
||||
@@ -71,7 +71,7 @@ impl ManagementApi for Server {
|
||||
#[cfg(feature = "enterprise")]
|
||||
Some("metrics") if self.core.is_enterprise_edition() => {
|
||||
// Validate the access token
|
||||
access_token.enforce_permission(Permission::MetricsLive)?;
|
||||
access_token.enforce_permission(Permission::LiveMetrics)?;
|
||||
|
||||
// Issue a live telemetry token valid for 60 seconds
|
||||
Ok(JsonResponse::new(json!({
|
||||
@@ -82,7 +82,7 @@ impl ManagementApi for Server {
|
||||
// SPDX-SnippetEnd
|
||||
Some("delivery") => {
|
||||
// Validate the access token
|
||||
access_token.enforce_permission(Permission::Troubleshoot)?;
|
||||
access_token.enforce_permission(Permission::LiveDeliveryTest)?;
|
||||
|
||||
// Issue a live telemetry token valid for 60 seconds
|
||||
Ok(JsonResponse::new(json!({
|
||||
@@ -108,7 +108,7 @@ impl ManagementApi for Server {
|
||||
) {
|
||||
("delivery", Some(target), &Method::GET) => {
|
||||
// Validate the access token
|
||||
access_token.enforce_permission(Permission::Troubleshoot)?;
|
||||
access_token.enforce_permission(Permission::LiveDeliveryTest)?;
|
||||
|
||||
let timeout = Duration::from_secs(
|
||||
params
|
||||
|
||||
@@ -49,7 +49,7 @@ impl TelemetryApi for Server {
|
||||
let params = UrlParams::new(req.uri().query());
|
||||
if is_tracing {
|
||||
// Validate the access token
|
||||
access_token.enforce_permission(Permission::TracingLive)?;
|
||||
access_token.enforce_permission(Permission::LiveTracing)?;
|
||||
|
||||
let mut key_filters = AHashMap::new();
|
||||
let mut filter = None;
|
||||
@@ -175,7 +175,7 @@ impl TelemetryApi for Server {
|
||||
))))
|
||||
} else {
|
||||
// Validate the access token
|
||||
access_token.enforce_permission(Permission::MetricsLive)?;
|
||||
access_token.enforce_permission(Permission::LiveMetrics)?;
|
||||
|
||||
let interval = Duration::from_secs(
|
||||
params
|
||||
|
||||
@@ -395,11 +395,11 @@ impl ParseHttp for Server {
|
||||
let path = req.uri().path();
|
||||
let (grant_type, permissions) = if path.starts_with("/api/telemetry/traces")
|
||||
{
|
||||
(GrantType::LiveTracing, Permission::TracingLive)
|
||||
(GrantType::LiveTracing, Permission::LiveTracing)
|
||||
} else if path.starts_with("/api/telemetry/metrics") {
|
||||
(GrantType::LiveMetrics, Permission::MetricsLive)
|
||||
(GrantType::LiveMetrics, Permission::LiveMetrics)
|
||||
} else if path.starts_with("/api/diagnose") {
|
||||
(GrantType::Diagnose, Permission::Troubleshoot)
|
||||
(GrantType::Diagnose, Permission::LiveDeliveryTest)
|
||||
} else {
|
||||
return Err(trc::ResourceEvent::NotFound.into_err());
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user