Merge main checkpoint c01a388 into feat/erp-inventar-export
Brings the ERP inventory export up to date with the platform backbone and field capture work. Conflicts in ARCHITECTURE.md, the API key service and the API key settings tab resolved by keeping both sides: - read and write keys stay separate; erp-inventory:read is read-only and cannot be combined with a write scope - the failed-attempt lockout counts in the shared ThrottlerHit table so it holds across API pods - the UI offers only scopes the user holds and creates one scope per key Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
commit
53fab102f2
347 files changed
+26087
-2141
No files matched your search
@@ -19,6 +19,24 @@ export const API_KEY_SCOPES = [
|
||||
|
||||
export type ApiKeyScope = (typeof API_KEY_SCOPES)[number];
|
||||
|
||||
/**
|
||||
* Scopes that book (change data). Every other scope only reads. A new key
|
||||
* never mixes both kinds: a leaked read key cannot book, a leaked booking
|
||||
* key cannot read (ARCHITECTURE.md, Annahme 14).
|
||||
*/
|
||||
export const API_KEY_WRITE_SCOPES = [
|
||||
'shop-sync:write',
|
||||
] as const satisfies readonly ApiKeyScope[];
|
||||
|
||||
export function isApiKeyScope(value: string): value is ApiKeyScope {
|
||||
return (API_KEY_SCOPES as readonly string[]).includes(value);
|
||||
}
|
||||
|
||||
function isWriteScope(scope: string): boolean {
|
||||
return (API_KEY_WRITE_SCOPES as readonly string[]).includes(scope);
|
||||
}
|
||||
|
||||
/** True if the scopes hold at least one reading and one booking right. */
|
||||
export function combinesReadAndWrite(scopes: readonly string[]): boolean {
|
||||
return scopes.some(isWriteScope) && scopes.some((s) => !isWriteScope(s));
|
||||
}
|
||||
Reference in new issue
Block a user