pub fn check_scopes<'a>(
required: &[&str],
granted: impl IntoIterator<Item = &'a str>,
) -> Result<(), ApiError>Expand description
Build the 403 Forbidden error for a principal lacking scopes.
Returns Ok(()) when every scope in required appears in granted.
§Errors
403 naming the missing scopes (scope names are not secret).
§Examples
use siderite_core::security::check_scopes;
assert!(check_scopes(&["read"], ["read", "write"]).is_ok());
assert_eq!(check_scopes(&["admin"], ["read"]).unwrap_err().status(), 403);