ProtectedconstructorStaticInstanceReturns the global singleton instance.
The subset of accountIDs that user may use for access, as normalized (NormalizeUUID) IDs — compare with
NormalizeUUID(id). An ID that is not a UUID, names no account, or names an account the user may not use is left
out; so is everything when the user cannot be evaluated or the permission read fails (fail closed).
MJ: File Storage Accounts IDs to ask about (duplicates and casing are ignored)
The user the decision is for
Read checks CanRead; Write checks CanWrite
Optionalprovider: IMetadataProviderThe metadata provider to read through; defaults to Metadata.Provider
Throws StorageAccountAccessDeniedError unless user may use storage account accountID for access. The
error carries STORAGE_ACCOUNT_ACCESS_DENIED_MESSAGE whether the account is restricted or does not exist.
Optionalprovider: IMetadataProviderThrows TrackedFileAccessDeniedError when any of objectKeys backs an MJ: Files row user may not read
(or is a key the checks refuse). See UnreadableTrackedObjectKeys for the rule.
Optionalprovider: IMetadataProviderProtectedFindReads, with the elevated reader, the MJ: Files rows on fileStorageProviderID whose stored object key
(StorageObjectKeyOf: ProviderKey, else Name), lower-cased, is one of lookupValues (already lower-cased). Batched, never truncated.
Returns null when the read could not be made. Protected so a host can change the mapping.
The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.
The decision for ONE account, given all of its permission rows: open when it has none (the current product rule —
see ACCOUNT_WITHOUT_PERMISSION_ROWS_IS_OPEN), otherwise granted when any row both allows access
(CanRead / CanWrite) and applies to user (an Everyone row, a Role row for one of user.UserRoles, or a
User row naming user.ID). A user that cannot be evaluated (no ID, or no UserRoles array) is refused.
ProtectedLoadReads, with the elevated reader, which of accountIDs exist and every permission row they have. Returns null when
the question could not be asked (no elevated reader, or a failed read) — callers fail closed.
Protected so a host with its own permission store can supply the state; accountIDs arrive validated and normalized.
Optionalprovider: IMetadataProviderProtectedResolveThe identity the permission rows and the MJ: Files mapping are read with: the MJ system user for provider's
connection, or null when this process has none. Protected so a host can supply a different elevated reader.
Which of objectKeys back an MJ: Files row that user may not read. An object is tracked when an MJ: Files row
on the account's storage provider resolves to it the way the server resolves every row to an object — ProviderKey,
or Name when ProviderKey is empty. The mapping is read with the elevated reader (so a row the user cannot see
still counts as tracked); whether the user may read each row is then asked as the user, through RunView (entity
permission and row-level security both apply, as they do for Load). Reads are batched and never truncated.
Matching. The key a caller sends and the key a row stores are both put through keyNormalizer — pass the
account's driver, whose NormalizeObjectKey knows how that driver spells one object several ways (S3's key prefix;
leading, trailing and repeated / everywhere) — and compared case-insensitively. The lookup finds rows whose stored
key is the canonical key with or without a leading or trailing /, or the caller's own spelling; a row stored in any
other non-canonical spelling (a driver prefix written into ProviderKey, doubled slashes) is not found, and MJ's
own writers store neither.
Refused keys. A key IsSafeStorageObjectKey rejects (a ./.. segment, a backslash, a
meaning-changing percent encoding, a control character) is always returned: its meaning depends on the provider,
so it is never compared.
Untracked keys are never returned — they are governed by the account gate alone. MJ: Files rows are keyed by
PROVIDER, not account, so a tracked row in another account on the same provider with the same key also counts: the
error is always toward refusing. Fails closed — when the mapping cannot be read every key is returned, and when the
user-side read fails every tracked key is.
The MJ: File Storage Providers ID of the account the objects live in
Object keys as the caller or the driver spells them (path and/or provider object ID)
Optionalprovider: IMetadataProviderThe account's canonicalizer (its driver); defaults to NormalizeStorageObjectKey
Whether user may use storage account accountID for access. See AccessibleAccountIDs.
Optionalprovider: IMetadataProviderProtected StaticgetReturns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.
OptionalclassName: string
Decides storage-account access (
Read/Write) and tracked-file read access for a user, per call. See the module documentation for the evaluation model.