Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /
io.realm.mongodb

Class User

java.lang.Object
io.realm.mongodb.User

A user holds the user's meta data and tokens for accessing Realm App functionality.The user is used to configure Synchronized Realms and gives access to calling Realm App Functions through Functions and accessing remote Realm App

Mongo Databases through a MongoClient .

Tip

  • App.login(Credenciales)

  • io.realm.mongodb.sync.SyncConfiguration.Builder.Builder(User, String)

Modificador y Tipo
Clase y descripción

public static final

Modificador y Tipo
Método y descripción

public booleano

Two Users are considered equal if they have the same user identity and are associated with the same app.

public String

Returns the current access token for the user.

public synchronized ApiKeyAuth

Devuelve un contenedor para gestionar claves API controladas por el usuario actual.

public App

Devuelve la aplicación con la que está asociado este usuario.

public Document

Return the custom user data associated with the user in the Realm App.

public String

Returns a unique identifier for the device the user logged in to.

public Functions

CodecRegistry codecRegistry
)

Returns a functions manager for invoking Realm Functions with custom codec registry for encoding and decoding arguments and results.

public synchronized Functions

Devuelve un administrador de funciones para invocar funciones de MongoDB Realm.

public String

Returns the server id of the user.

pública Lista

Devuelve una nueva lista de identidades del usuario.

public synchronized MongoClient

String serviceName
)

Returns a MongoClient instance for accessing documents in the database.

Devuelve el perfil de este usuario.

Returns the provider type used to log the user

public synchronized Push

public String

Devuelve el token de actualización actual para el usuario.

public User.State

Devuelve el estado en el que se encuentra el usuario.

public int

public booleano

Returns true if the user is currently logged in.

public User

Links the current user with a new user identity represented by the given credentials.

Links the current user with a new user identity represented by the given credentials.

public void

Log the user out of the Realm App.

Cerrar la sesión del usuario de la Aplicación Realm de forma asíncrona.

Re-fetch custom user data from the Realm App asynchronously.

public Document

Re-fetch custom user data from the Realm App.

public User

Al llamar a esto se eliminará al usuario y cualquier Reino que tenga el usuario del dispositivo.

Calling this will asynchronously remove the user and any Realms the user has from the device.

  • Methods inherited from class java.lang.Object : getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

public boolean equals (
)

Two Users are considered equal if they have the same user identity and are associated with the same app.

Anulaciones

equals en la clase Objeto

Returns the current access token for the user.

Devuelve

the current access token.

public synchronized ApiKeyAuth getApiKeys ()

Devuelve un contenedor para gestionar claves API controladas por el usuario actual.

Devuelve

wrapper for managing API keys controlled by the current user.

Throws

public App getApp ()

Devuelve la aplicación con la que está asociado este usuario.

Devuelve

the App this user is associated with.

public Document getCustomData ()

Devuelve los datos de usuario personalizados asociados al usuario en la aplicación de Realm. Los datos solo se actualizan cuando el token de acceso del usuario se actualiza o cuando se llama explícitamente a refreshCustomData() .

Devuelve

The custom user data associated with the user.

Returns a unique identifier for the device the user logged in to.

Devuelve

a unique device identifier for the user.

CodecRegistry codecRegistry
)

Returns a functions manager for invoking Realm Functions with custom codec registry for encoding and decoding arguments and results.

Parámetros

  • codecRegistry - The codec registry to use for encoding and decoding arguments and results towards the remote Realm App.

public synchronized Functions getFunctions ()

Devuelve un administrador de funciones para invocar funciones de MongoDB Realm. Esto utilizará el registro de códec predeterminado de la aplicación asociada para codificar y decodificar argumentos y resultados.

public String getId ()

Returns the server id of the user.

Devuelve

the server id of the user.

Devuelve una nueva lista de identidades del usuario.

Devuelve

the list of identities.

public synchronized MongoClient getMongoClient (
String serviceName
)

Returns a MongoClient instance for accessing documents in the database.

Parámetros

  • serviceName - el nombre del servicio utilizado para conectarse al servidor.

Devuelve el perfil de este usuario.

Devuelve

the profile for this user

Returns the provider type used to log the user

Devuelve

the provider type of the user

public synchronized Push getPush (
String serviceName
)

Devuelve la instancia Push para administrar los registros de notificaciones push.

Parámetros

  • serviceName - el nombre del servicio utilizado para conectarse al servidor.

Devuelve el token de actualización actual para el usuario.

Devuelve

el token de actualización actual.

Devuelve el estado en el que se encuentra el usuario.

Devuelve

the State of the user.

public int hashCode ()

Anulaciones

hashCode en la clase Objeto

public boolean isLoggedIn ()

Returns true if the user is currently logged in. Returns whether or not this user is still logged into the MongoDB Realm App.

Devuelve

true if still logged in, false if not.

Credentials credentials
)

Links the current user with a new user identity represented by the given credentials.Linking a user with more credentials, mean the user can login either of these credentials. It also makes it possible to "upgrade" an anonymous user by linking it with e.g. Email/Password credentials.

// Example
App app = new App("app-id")
User user = app.login(Credentials.anonymous());
user.linkCredentials(Credentials.emailPassword("email", "password"));

Nota: No es posible vincular dos usuarios existentes de MongoDB Realm. Las credenciales proporcionadas no deben haber sido utilizadas por otro usuario.

Parámetros

  • credentials - the credentials to link with the current user.

Devuelve

el Usuario al que estaban vinculadas las credenciales.

Throws

Links the current user with a new user identity represented by the given credentials.Linking a user with more credentials, mean the user can login either of these credentials. It also makes it possible to "upgrade" an anonymous user by linking it with e.g. Email/Password credentials.

// Example
App app = new App("app-id")
User user = app.login(Credentials.anonymous());
user.linkCredentials(Credentials.emailPassword("email", "password"));

Nota: No es posible vincular dos usuarios existentes de MongoDB Realm. Las credenciales proporcionadas no deben haber sido utilizadas por otro usuario.

Parámetros

  • credentials - the credentials to link with the current user.

  • callback - callback when user identities has been linked or it failed. The callback will always happen on the same thread as this method is called on.

Throws

public void logOut ()

Log the user out of the Realm App. This will unregister them on the device and stop any synchronization to and from the users' Realms. Any Realms owned by the user will not be deleted from the device before User.remove() is called.

Una vez que la aplicación Realm ha confirmado el cierre de sesión, cualquier AuthenticationListener registrado será notificado y las credenciales del usuario se borrarán de este dispositivo.

Logging out anonymous users will remove them immediately instead of marking them as User.State.LOGGED_OUT .

All other users will be marked as User.State.LOGGED_OUT and will still be returned by App.allUsers() . They can be removed completely by calling User.remove() .

Throws

  • AppException - if an error occurred while trying to log the user out of the Realm App.

Log the user out of the Realm App asynchronously. This will unregister them on the device and stop any synchronization to and from the users' Realms. Any Realms owned by the user will not be deleted from the device before User.remove() is called.

Una vez que la aplicación Realm ha confirmado el cierre de sesión, cualquier AuthenticationListener registrado será notificado y las credenciales del usuario se borrarán de este dispositivo.

Logging out anonymous users will remove them immediately instead of marking them as User.State.LOGGED_OUT .

All other users will be marked as User.State.LOGGED_OUT and will still be returned by App.allUsers() . They can be removed completely by calling User.remove() .

Parámetros

  • callback - función de retorno cuando cerrar sesión se ha completado o ha fallado. La función de retorno siempre ocurrirá en el mismo hilo en el que se llame este método.

Throws

Recupere datos de usuario personalizados de la aplicación Realm de forma asincrónica. Esta es la variante asincrónica de refreshCustomData().

Parámetros

  • callback - La función de retorno que recibirá el resultado o cualquier error de la solicitud.

Devuelve

The task representing the ongoing operation.

Throws

public Document refreshCustomData ()

Re-fetch custom user data from the Realm App.

Devuelve

The updated custom user data associated with the user.

Throws

public User remove ()

Al llamar a este método, se eliminará al usuario y cualquier dominio que tenga del dispositivo. No se eliminan datos del servidor. Si el usuario tiene la sesión iniciada al llamar a este método, se cerrará la sesión antes de eliminar los datos.

Devuelve

el usuario que fue eliminado.

Throws

  • AppException - if an error occurred while trying to remove the user.

Al llamar a este método, se eliminará asincrónicamente del dispositivo al usuario y cualquier dominio que tenga. No se eliminan datos del servidor. Si el usuario tiene la sesión iniciada al llamar a este método, se cerrará la sesión antes de eliminar los datos.

Parámetros

  • callback - función de retorno cuando al eliminar el usuario se haya completado o fallado. La función de retorno siempre ocurrirá en el mismo hilo en el que se llame este método.

Throws

Volver

RealmResultTask

En esta página