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 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
  • Returns an AsyncThrowingStream indicating whether the user has opted in to user presence for the current structure.

    The stream yields true if the user has opted in to user presence, and false otherwise.

    Declaration

    Swift

    func presenceOptInStatus() async -> AsyncThrowingStream<Bool, any Error>
  • Sets the user’s opt-in status for user presence for the current structure.

    This will update the UserPresenceSettingsTrait of the ApplicationInfo object which is managed on a per-application, per-structure, per-user basis.

    Throws

    A HomeError error if the opt-in status could not be updated.

    Declaration

    Swift

    func setPresenceOptIn(_ optIn: Bool) async throws

    Parameters

    optIn

    true to opt the user in, false to opt the user out.