User

public struct User

Represents a user.

  • Username

    Declaration

    Swift

    public let userName: String?
  • Email

    Declaration

    Swift

    public let email: String?
  • First Name

    Declaration

    Swift

    public let firstName: String?
  • Last Name

    Declaration

    Swift

    public let lastName: String?
  • Realm roles of the user

    Declaration

    Swift

    public var realmRoles: [String] { get }
  • Client roles of the user

    Declaration

    Swift

    public var clientRoles: [String] { get }
  • Raw value of the access token. Should be used to perform other requests

    Declaration

    Swift

    public let accessToken: String?
  • Identity token

    Declaration

    Swift

    public let identityToken: String?
  • Full Name built using firstName and lastName. If both are not set or empty, nil will be returned

    Declaration

    Swift

    public var fullName: String? { get }
  • Check if the user has a client role.

    Declaration

    Swift

    public func hasClientRole(client: String, role: String) -> Bool

    Parameters

    client

    name of the client

    role

    name of the role to check

    Return Value

    true if user has the client role, otherwise false

  • Check if the user has a realm role.

    Declaration

    Swift

    public func hasRealmRole(_ roleName: String) -> Bool

    Parameters

    roleName

    Name of the role

    Return Value

    true if user has the realm role, otherwise false

  • Gets the custom user attribute.

    Declaration

    Swift

    public func customAttribute<T>(_ attributeName: String) -> T?

    Parameters

    attributeName

    the user attribute to retrieve

    Return Value

    the custom attribute if it exists, otherwise nil