feat(kanban): partition local queues by account
req: sync/020 req: auth/005 req: security/004 req: operations/002
This commit is contained in:
@@ -428,6 +428,7 @@ async fn main() {
|
||||
.route("/events", get(events))
|
||||
.route("/sync-demo", get(sync_demo))
|
||||
.route("/sync.js", get(sync_js))
|
||||
.route("/sync/context", get(sync_context))
|
||||
.route("/sync/commands", post(sync_command))
|
||||
.route("/sync/acknowledgements", get(sync_acknowledgements))
|
||||
.route("/sync/snapshot", get(sync_snapshot))
|
||||
@@ -585,6 +586,23 @@ fn current_sync_principal(
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct SyncContext {
|
||||
account_partition: String,
|
||||
}
|
||||
|
||||
// req: sync/020 req: auth/005
|
||||
async fn sync_context(
|
||||
State(state): State<Arc<AppState>>,
|
||||
headers: HeaderMap,
|
||||
) -> Result<Json<SyncContext>, SyncRejection> {
|
||||
let principal = current_sync_principal(&headers, &state.sync_sessions)?;
|
||||
Ok(Json(SyncContext {
|
||||
account_partition: format!("{}:{}", principal.tenant, principal.principal),
|
||||
}))
|
||||
}
|
||||
|
||||
fn authorize_sync_replay(
|
||||
principal: CurrentSyncPrincipal,
|
||||
card_id: u64,
|
||||
|
||||
Reference in New Issue
Block a user