MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / make_auth

Function make_auth

nodedb/src/control/security/predicate.rs:213–227  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

211 use crate::types::TenantId;
212
213 fn make_auth() -> AuthContext {
214 let identity = AuthenticatedIdentity {
215 user_id: 123,
216 username: "alice".into(),
217 tenant_id: TenantId::new(1),
218 roles: vec![Role::ReadWrite],
219 auth_method: AuthMethod::ApiKey,
220 is_superuser: false,
221 default_database: None,
222 accessible_databases: crate::control::security::identity::DatabaseSet::Some(
223 smallvec::smallvec![nodedb_types::id::DatabaseId::DEFAULT],
224 ),
225 };
226 AuthContext::from_identity(&identity, "test-session".into())
227 }
228
229 #[test]
230 fn simple_equality_substitution() {

Callers 10

literal_comparisonFunction · 0.70
auth_contains_checkFunction · 0.70
field_contains_auth_refFunction · 0.70
and_combinationFunction · 0.70
or_combinationFunction · 0.70
missing_auth_ref_deniesFunction · 0.70
empty_policies_allow_allFunction · 0.70

Calls

no outgoing calls

Tested by 10

literal_comparisonFunction · 0.56
auth_contains_checkFunction · 0.56
field_contains_auth_refFunction · 0.56
and_combinationFunction · 0.56
or_combinationFunction · 0.56
missing_auth_ref_deniesFunction · 0.56
empty_policies_allow_allFunction · 0.56