mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 09:26:52 +01:00
Ports 14 concern-sized articles (8 performance, 6 security) and 25
AL samples from BC Code Intelligence, restructured to BCQuality's v1
schema and layered under /community/knowledge/. Each article is
atomic, under 100 lines, and ships <slug>.good.al and (where the
pattern has a clear anti-example) <slug>.bad.al siblings.
Jesper's microsoft-layer leaves (al-performance-review and
al-security-review) source across every enabled layer via
*/knowledge/<domain>/**, so these additions are picked up by the
existing action skills without any new skill definitions.
Performance (8):
- use-deleteall-for-filtered-bulk-deletion
- call-setloadfields-before-filters
- load-common-fields-before-branching-on-case
- load-only-primary-key-fields-for-reference-work
- omit-filter-only-fields-from-setloadfields
- choose-maintainsiftindex-by-read-write-ratio
- avoid-growing-globals-in-singleinstance-subscribers
- order-case-branches-by-frequency
Security (6):
- classify-every-field-with-dataclassification
- protect-sensitive-data-in-temporary-tables
- guard-bulk-operations-with-istemporary
- compose-permission-sets-with-included-sets
- do-not-grant-rights-beyond-a-users-entitlement
- prefer-oauth2-over-api-keys-for-external-http-calls
Graveyard-bound items (not ported; to be captured in a later
/docs/triage-graveyard.md):
- testfield-performance (soft guidance, low actionability)
- table-event-batch-operation-impact (keep-event-subscribers-lightweight
already carries the core insight)
- Most of /roger-reviewer (AL formatting - frontier-model territory)
- sift-technology-fundamentals (descriptive, not a citable concern)
- bc-telemetry-buddy-* (tooling promotion, not guidance)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.4 KiB
AL
44 lines
1.4 KiB
AL
codeunit 50100 "Partner API Client"
|
|
{
|
|
procedure FetchOrders(var Response: Text): Boolean
|
|
var
|
|
OAuth2: Codeunit OAuth2;
|
|
HttpClient: HttpClient;
|
|
HttpRequest: HttpRequestMessage;
|
|
HttpResponse: HttpResponseMessage;
|
|
AccessToken: SecretText;
|
|
Scopes: List of [Text];
|
|
begin
|
|
Scopes.Add('https://partner.example.com/.default');
|
|
|
|
// Client-credentials flow for service-to-service. Tokens expire and rotate
|
|
// on their own schedule; secret and client id are retrieved from IsolatedStorage.
|
|
if not OAuth2.AcquireTokenWithClientCredentials(
|
|
GetClientIdFromIsolatedStorage(),
|
|
GetClientSecretFromIsolatedStorage(),
|
|
'https://login.example.com/tenantid/oauth2/v2.0/token',
|
|
'',
|
|
Scopes,
|
|
AccessToken)
|
|
then
|
|
exit(false);
|
|
|
|
HttpRequest.SetRequestUri('https://partner.example.com/orders');
|
|
HttpRequest.Method('GET');
|
|
HttpRequest.GetHeaders().Add('Authorization', SecretStrSubstNo('Bearer %1', AccessToken));
|
|
|
|
if not HttpClient.Send(HttpRequest, HttpResponse) then
|
|
exit(false);
|
|
|
|
HttpResponse.Content.ReadAs(Response);
|
|
exit(HttpResponse.IsSuccessStatusCode);
|
|
end;
|
|
|
|
local procedure GetClientIdFromIsolatedStorage(): Text
|
|
begin
|
|
end;
|
|
|
|
local procedure GetClientSecretFromIsolatedStorage(): SecretText
|
|
begin
|
|
end;
|
|
}
|