databrary-1: Databrary

Safe HaskellNone
LanguageHaskell2010

Model.Party.SQL

Synopsis

Documentation

updateParty Source #

Arguments

:: Name

@AuditIdentity

-> Name
Party
-> ExpQ 

updateAccount Source #

Arguments

:: Name

@AuditIdentity

-> Name
Account
-> ExpQ 

insertParty Source #

Arguments

:: Name

@AuditIdentity

-> Name
Party
-> ExpQ
PartyRow

insertAccount Source #

Arguments

:: Name

@AuditIdentity

-> Name
Account
-> ExpQ 

deleteParty Source #

Arguments

:: Name

@AuditIdentity

-> Name
Party
-> ExpQ
()

deleteAccount Source #

Arguments

:: Name

@AuditIdentity

-> Name
Party
-> ExpQ
()

makeSiteAuth :: Account -> Maybe ByteString -> Maybe Access -> SiteAuth Source #

Build a SiteAuth object using the provided Account, possible password, and possible access object. If no access object is provided, then use (None, None) for the access object.

makeUserAccount :: (Permission -> Maybe Access -> Account) -> Account Source #

Build an account, using ADMIN permission and (ADMIN,ADMIN) access object. Essentially a user has full permissions over themselves and the access object nested within the account party has max privileges. I suspect that the access object within a Party, when nested inside of a SiteAuth is almost never used, as the Has instances all retrieve siteAccess, not (partyAccess . accountParty . siteAccount)

makeAccount :: PartyRow -> (Party -> Account) -> Permission -> Maybe Access -> Account Source #

Used by makeUserAccount and selectPermissionAccount. This finishes building the circular Party and Account structure.

permissionParty Source #

Arguments

:: Has (Id Party) a 
=> (Permission -> Maybe Access -> a)

Partially applied makeParty, ready to build full account or party

-> Maybe Access

The direct authorization that the party/account being built may have authorized to the viewing identity/user. This is only used by lookupAuthParty, which is only used in the context of retreiving a party for editing/viewing in isolation by the party controller actions

-> Identity

The viewing identity / user which is trying to view or edit the party being retrieved.

-> a

account or party

Build an account or party, based on calling context. Compute permission and access by coalescing authorization granted directly and generally

makeParty :: PartyRow -> Maybe (Party -> Account) -> Permission -> Maybe Access -> Party Source #

Build party, with a circular connection to an account if an account creation function is provided

makeParty2 :: PartyRow -> Maybe (Party -> Account) -> Loaded Permission -> Permission -> Maybe Access -> Party Source #

Build party, with a circular connection to an account if an account creation function is provided. Transition function taking mSiteAccess until all queries use this.