StructureScopedPermissionsController

struct StructureScopedPermissionsController
extension StructureScopedPermissionsController : Sendable

A controller for managing structure scoped permissions.

  • A feature that can be consented to via the permissions controller.

    Declaration

    Swift

    enum Feature
    extension StructureScopedPermissionsController.Feature : CaseIterable, Equatable, Hashable, Sendable
  • The status of the consent.

    Declaration

    Swift

    enum ConsentStatus
    extension StructureScopedPermissionsController.ConsentStatus : Equatable, Hashable, Sendable
  • The response from the consent request.

    Declaration

    Swift

    enum ConsentResponse
    extension StructureScopedPermissionsController.ConsentResponse : Sendable
  • Returns a set of all features for which the user has granted consent.

    Declaration

    Swift

    func consentedFeatures() async -> Set<StructureScopedPermissionsController.Feature>
  • The consent status for the given features.

    Declaration

    Swift

    func featureConsentState(features: [StructureScopedPermissionsController.Feature]) async -> [StructureScopedPermissionsController.Feature : StructureScopedPermissionsController.ConsentStatus]

    Parameters

    features

    The features to retrieve the consent status for.

    Return Value

    A map of feature to consent status.

  • Returns an asynchronous stream emitting consent states for the given features.

    Declaration

    Swift

    func featureConsentStateStream(features: [StructureScopedPermissionsController.Feature]) -> AsyncThrowingStream<[StructureScopedPermissionsController.Feature : StructureScopedPermissionsController.ConsentStatus], any Error>

    Parameters

    features

    The features to retrieve the consent status stream for.

    Return Value

    An asynchronous throwing stream emitting a map of feature to consent status whenever it updates.

  • Returns the device type permissions that have been granted to this app for the current structure.

    Note: Permissions are managed on a per-device-type basis. For sensitive devices, granting permission to a single device results in permission being granted for all devices of that same type within the structure.

    Declaration

    Swift

    func deviceTypeGrants() async -> DeviceTypeGrants
  • Presents a view for users to consent to the given features.

    Declaration

    Swift

    func requestConsent(for features: [StructureScopedPermissionsController.Feature]) async -> StructureScopedPermissionsController.ConsentResponse?

    Return Value

    The response from the consent request. Returns nil if the user has already consented to the features or an error occurred.

  • Undocumented

    Declaration

    Swift

    struct UserMetadata
    extension StructureScopedPermissionsController.UserMetadata : Equatable, Sendable
  • Fetches the metadata for the currently signed-in user within the context of this structure.

    This includes information such as the user’s ID, email, profile picture URL, and name.

    Declaration

    Swift

    func currentUserMetadata() async throws -> StructureScopedPermissionsController.UserMetadata