Skip to main content

SecuredApp

Struct SecuredApp 

Source
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

Source

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.

Source

pub fn language(self, language: Language) -> Self

The language of its screens.

Source

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.

Source

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.

Source

pub fn merge(self, merge: RoleMerge) -> Self

How the roles of one person come together.

Source

pub fn audit(self, settings: AuditSettings) -> Self

Writes who changed what to the audit trail, in the same commit as each change.

Source

pub fn authenticator(self, authenticator: impl Authenticator + 'static) -> Self

Another way of signing in than the passwords it keeps, as with an outside provider.

Source

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.

Source

pub fn build(self) -> Result<AnyView, ModelError>

Puts it together, or says what is wrong with how it was declared.

Source

pub fn into_view(self) -> AnyView

Puts it together, showing on the screen what is wrong with how it was declared.

Trait Implementations§

Source§

impl Debug for SecuredApp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Finish for T

§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more