TsgcWSAPIKeyManagerMethods › ListScopes

ListScopes Method

Returns the scopes attached to a key.

Syntax

function ListScopes(const aKey: string): TsgcAPIKeyScopes;

Parameters

NameTypeDescription
aKeyconst stringRaw plaintext key to inspect (re-hashed internally).

Return Value

A TsgcAPIKeyScopes dynamic array (array of string) with the scope identifiers attached to the key. Empty array when the key is unknown or carries no scopes. The returned array is a copy — modifying it does not alter the stored state. (TsgcAPIKeyScopes)

Remarks

Read-only snapshot of the scope list currently stored for the key, in insertion order. Use it to paint the "Permissions" panel of an admin UI, to mirror scopes into a JWT claim set, or to compare against the Scopes catalog when auditing drift. To check a single scope use HasScope (constant-time) rather than scanning the array yourself.

Example

var
  oScopes: TsgcAPIKeyScopes;
  vScope: string;
begin
  oScopes := sgcWSAPIKeyManager1.ListScopes(vKey);
  for vScope in oScopes do
    Memo1.Lines.Add('Scope: ' + vScope);
end;

Back to Methods