Member Junction
    Preparing search index...

    Decides storage-account access (Read / Write) and tracked-file read access for a user, per call. See the module documentation for the evaluation model.

    const evaluator = StorageAccessEvaluator.Instance;
    await evaluator.AssertAccountAccess(accountId, contextUser, 'Write', provider); // throws when refused
    const readable = await evaluator.AccessibleAccountIDs(ids, contextUser, 'Read', provider);
    if (readable.has(NormalizeUUID(id))) { ... }

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get GlobalKey(): string

      Returns string

    Methods

    • 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).

      Parameters

      • accountIDs: string[]

        MJ: File Storage Accounts IDs to ask about (duplicates and casing are ignored)

      • user: UserInfo

        The user the decision is for

      • access: StorageAccountAccess

        Read checks CanRead; Write checks CanWrite

      • Optionalprovider: IMetadataProvider

        The metadata provider to read through; defaults to Metadata.Provider

      Returns Promise<Set<string>>

    • Reads, 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.

      Parameters

      Returns Promise<TrackedFileRow[]>

    • 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.

      Returns GlobalObjectStore

    • 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.

      Parameters

      • fileStorageProviderID: string

        The MJ: File Storage Providers ID of the account the objects live in

      • objectKeys: string[]

        Object keys as the caller or the driver spells them (path and/or provider object ID)

      • user: UserInfo
      • Optionalprovider: IMetadataProvider
      • keyNormalizer: StorageObjectKeyNormalizer = DEFAULT_OBJECT_KEY_NORMALIZER

        The account's canonicalizer (its driver); defaults to NormalizeStorageObjectKey

      Returns Promise<Set<string>>

    • Returns 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.

      Type Parameters

      Parameters

      • this: new () => T
      • OptionalclassName: string

      Returns T