pub struct SecurityConfig {
pub role_definitions: Vec<RoleDefinition>,
pub default_role: Option<String>,
pub multi_tenant: bool,
pub additional: HashMap<String, Value>,
}Expand description
Security configuration from fraiseql.toml.
Contains role definitions and other security-related settings that are compiled into schema.compiled.json.
Fields§
§role_definitions: Vec<RoleDefinition>Role definitions mapping role names to their granted scopes.
default_role: Option<String>Default role when none is specified.
multi_tenant: boolWhether this schema serves multiple tenants with data isolation via RLS.
When true and caching is enabled, FraiseQL verifies that Row-Level Security
is active on the database at startup. This prevents silent cross-tenant data
leakage through the cache.
Set rls_enforcement in CacheConfig to control whether a missing RLS check
causes a startup failure or only emits a warning.
additional: HashMap<String, Value>Additional security settings (rate limiting, audit logging, etc.)
Implementations§
Source§impl SecurityConfig
impl SecurityConfig
Sourcepub fn add_role(&mut self, role: RoleDefinition)
pub fn add_role(&mut self, role: RoleDefinition)
Add a role definition.
Sourcepub fn find_role(&self, name: &str) -> Option<&RoleDefinition>
pub fn find_role(&self, name: &str) -> Option<&RoleDefinition>
Find a role definition by name.
Sourcepub fn get_role_scopes(&self, role_name: &str) -> Vec<String>
pub fn get_role_scopes(&self, role_name: &str) -> Vec<String>
Get all scopes granted to a role.
Sourcepub fn role_has_scope(&self, role_name: &str, scope: &str) -> bool
pub fn role_has_scope(&self, role_name: &str, scope: &str) -> bool
Check if a role has a specific scope.
Trait Implementations§
Source§impl Clone for SecurityConfig
impl Clone for SecurityConfig
Source§fn clone(&self) -> SecurityConfig
fn clone(&self) -> SecurityConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SecurityConfig
impl Debug for SecurityConfig
Source§impl Default for SecurityConfig
impl Default for SecurityConfig
Source§fn default() -> SecurityConfig
fn default() -> SecurityConfig
Source§impl<'de> Deserialize<'de> for SecurityConfig
impl<'de> Deserialize<'de> for SecurityConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SecurityConfig
impl PartialEq for SecurityConfig
Source§impl Serialize for SecurityConfig
impl Serialize for SecurityConfig
impl Eq for SecurityConfig
impl StructuralPartialEq for SecurityConfig
Auto Trait Implementations§
impl Freeze for SecurityConfig
impl RefUnwindSafe for SecurityConfig
impl Send for SecurityConfig
impl Sync for SecurityConfig
impl Unpin for SecurityConfig
impl UnsafeUnpin for SecurityConfig
impl UnwindSafe for SecurityConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more