← Changelog
NewApps

Web apps get accounts, members, invitations and roles for their own users

A new web app's users belong to accounts (teams, organizations) through member records with a role, owner, admin or member, act in one account at a time, and invite others by email: a /team page, an invitation email, and the models and actions behind them, all starter code to change as you like. A user record also has a roles field for app-wide roles such as staff. The records route holds a signed-in user's calls to all of their roles at once, and permissions.ib.ts grants what belongs to an account with { $session: "accountId" }, so every member sees their account's records and no one else's.

Under the hood, a call may now carry several roles (asRole(["signed-in", "account-admin"], session)): it's held to the union of their grants, and a session may carry an accountId. That's in the API, the SDK and the test harness for every app, Shopify ones included. Preview as a user picks the account too, when the user belongs to several.

Apps created before today keep the single signed-in role; the models and web/lib/team.ts can be copied from a new app. The client portal and staff tool recipes will build on this.

More in Accounts, members and roles.