LCOV - code coverage report
Current view: top level - storage_controller/src - auth.rs (source / functions) Coverage Total Hit
Test: 4be46b1c0003aa3bbac9ade362c676b419df4c20.info Lines: 0.0 % 15 0
Test Date: 2025-07-22 17:50:06 Functions: 0.0 % 2 0

            Line data    Source code
       1              : use utils::auth::{AuthError, Claims, Scope};
       2              : use uuid::Uuid;
       3              : 
       4            0 : pub fn check_permission(claims: &Claims, required_scope: Scope) -> Result<(), AuthError> {
       5            0 :     if claims.scope != required_scope {
       6            0 :         return Err(AuthError("Scope mismatch. Permission denied".into()));
       7            0 :     }
       8              : 
       9            0 :     Ok(())
      10            0 : }
      11              : 
      12              : #[allow(dead_code)]
      13            0 : pub fn check_endpoint_permission(claims: &Claims, endpoint_id: Uuid) -> Result<(), AuthError> {
      14            0 :     if claims.scope != Scope::TenantEndpoint {
      15            0 :         return Err(AuthError("Scope mismatch. Permission denied".into()));
      16            0 :     }
      17            0 :     if claims.endpoint_id != Some(endpoint_id) {
      18            0 :         return Err(AuthError("Endpoint id mismatch. Permission denied".into()));
      19            0 :     }
      20            0 :     Ok(())
      21            0 : }
        

Generated by: LCOV version 2.1-beta