pub struct SecuredApp { /* private fields */ }Expand description
An application people sign in to, each seeing what their roles allow.
Storage has to know security_entities, and audit_entity with an audit trail. The
application is made anew for each person, once they have signed in, so nothing of its model is
read before that, and every view goes through a SecuredObjectSpace.
use ravenrs_app::{EntityInfo, FieldInfo, FieldKind, MemoryDatabase, security_entities};
use ravenrs_app_ui::{App, SecuredApp};
let account = EntityInfo::new("Account")
.navigation("Records")
.field(FieldInfo::new("id", FieldKind::Integer).key())
.field(FieldInfo::new("name", FieldKind::Text));
let mut entities = security_entities();
entities.push(account.clone());
let database = MemoryDatabase::new(entities)?;
let window = SecuredApp::new("Accounts", move || database.space(), move |_person| {
App::new("Accounts").entity_info(account.clone())
})
.build()?;Implementations§
Source§impl SecuredApp
impl SecuredApp
Sourcepub fn new<S: ObjectSpace + 'static>(
title: impl Into<String>,
space: impl Fn() -> S + 'static,
application: impl Fn(&Identity) -> App + 'static,
) -> Self
pub fn new<S: ObjectSpace + 'static>( title: impl Into<String>, space: impl Fn() -> S + 'static, application: impl Fn(&Identity) -> App + 'static, ) -> Self
Over what space makes, with no permissions of its own. application says what the
application has, for whoever signed in; its storage and seed are replaced by what is here.
Sourcepub fn texts(self, language: impl Into<String>, json: impl Into<String>) -> Self
pub fn texts(self, language: impl Into<String>, json: impl Into<String>) -> Self
Adds or replaces words, as App::texts does, for the screen of signing in and for the
application of each person.
Sourcepub fn role(self, role: Role) -> Self
pub fn role(self, role: Role) -> Self
A role declared in code. Its record is created if missing, and it adds to what that says.
Sourcepub fn audit(self, settings: AuditSettings) -> Self
pub fn audit(self, settings: AuditSettings) -> Self
Writes who changed what to the audit trail, in the same commit as each change.
Sourcepub fn authenticator(self, authenticator: impl Authenticator + 'static) -> Self
pub fn authenticator(self, authenticator: impl Authenticator + 'static) -> Self
Another way of signing in than the passwords it keeps, as with an outside provider.
Sourcepub fn seed(
self,
seed: impl FnOnce(&mut dyn ObjectSpace) -> Result<(), String> + 'static,
) -> Self
pub fn seed( self, seed: impl FnOnce(&mut dyn ObjectSpace) -> Result<(), String> + 'static, ) -> Self
What is in its records when it opens, with no permissions in the way, once per run.
Sourcepub fn build(self) -> Result<AnyView, ModelError>
pub fn build(self) -> Result<AnyView, ModelError>
Puts it together, or says what is wrong with how it was declared.