Skip to content

(DOCSP-39525): Consolidate Create and Delete Users page #3289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The C++ SDK does not have the ability to delete users through the SDK.
You can delete users from the server using the :ref:`App Services
Admin API <admin-api>` ``delete a user`` endpoints. You could optionally
create an :ref:`Atlas Function <functions>` that uses the Admin API to
delete a user, and :ref:`call the function from the SDK <sdks-call-function>`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The C++ SDK does not have the ability to remove users through the SDK.
Instead, you could :ref:`log out the user <sdks-logout>`, and then manually
delete the user's synced database and cached app files from the filesystem.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To delete a user, call the :dotnet-sdk:`DeleteUserFromServerAsync(User)
<reference/Realms.Sync.App.html#Realms_Sync_App_DeleteUserFromServerAsync_Realms_Sync_User_>`
method.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Call the :dotnet-sdk:`RemoveUserAsync(User)
<reference/Realms.Sync.App.html#Realms_Sync_App_RemoveUserAsync_Realms_Sync_User_>`
method to remove the user and their data from the device.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Call the :flutter-sdk:`App.deleteUser() <realm/App/deleteUser.html>`
on a user object to delete the user's account from your App Services App.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Call the :flutter-sdk:`App.removeUser() <realm/latest/realm/App/removeUser.html>`
on a user object to remove the user and their data from the device.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The Java SDK does not have the ability to delete users through the SDK.
You can delete users from the server using the :ref:`App Services
Admin API <admin-api>` ``delete a user`` endpoints. You could optionally
create an :ref:`Atlas Function <functions>` that uses the Admin API to
delete a user, and :ref:`call the function from the SDK <sdks-call-function>`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To remove a ``User`` object from your client app, call the
:java-sdk:`User.remove() <io/realm/mongodb/User.html#remove()>` or
:java-sdk:`User.removeAsync()
<io/realm/mongodb/User.html#removeAsync(io.realm.mongodb.App.Callback)>`
method.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Call the :js-sdk:`App.deleteUser() <classes/App.html#deleteUser>` method with a
user object to delete the user from your App Services App. This deletes the
object from the server in addition to clearing data from the device.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Call the :js-sdk:`App.removeUser()
<https://www.mongodb.com/docs/realm-sdks/js/latest/classes/App.html#removeUser>`
method with a user object to remove the user from the device. This clears user
data from the device, but does not delete the user from Atlas.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To permanently delete a ``User`` object from both your client app
*and* the Atlas App Services App, call the :kotlin-sync-sdk:`delete
<io.realm.kotlin.mongodb/-user/delete.html>` method on a logged-in user:
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To remove a ``User`` object from your client app, call the
:kotlin-sync-sdk:`remove <io.realm.kotlin.mongodb/-user/remove.html>`
method on a user:
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
You can call the :objc-sdk:`-deleteWithCompletion
<Classes/RLMUser.html#/c:objc(cs)RLMUser(im)deleteWithCompletion:>`
method on a :objc-sdk:`RLMUser object <Classes/RLMUser.html>` to delete the
user object from your App Services App. This deletes the object from the
server in addition to clearing data from the device.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
You can call the :objc-sdk:`-removeWithCompletion
<Classes/RLMUser.html#/c:objc(cs)RLMUser(im)removeWithCompletion:>`
method on a :objc-sdk:`RLMUser object <Classes/RLMUser.html>` to remove the
user from the device. This clears user data from the device, but does not
delete the user from Atlas.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
You can call the :swift-sdk:`delete
<Extensions/User.html#/s:So7RLMUserC10RealmSwiftE6delete7Combine6FutureCyyts5Error_pGyF>`
method on a user object to delete the user object from your App Services App.
This deletes the object from the server in addition to clearing data from the
device.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
You can call the :swift-sdk:`remove
<Extensions/User.html#/s:So7RLMUserC10RealmSwiftE6remove7Combine6FutureCyyts5Error_pGyF>`
method on a user object to remove the user from the device. This clears user
data from the device, but does not delete the user from Atlas.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.. tabs-drivers::

tabs:
- id: cpp-sdk
content: |

.. literalinclude:: /examples/MissingPlaceholders/api.cpp
:language: cpp

- id: csharp
content: |

.. literalinclude:: /examples/generated/dotnet/WorkWithRealm.snippet.delete-user.cs
:language: csharp

- id: dart
content: |

.. literalinclude:: /examples/generated/flutter/authenticate_users_test.snippet.delete-user.dart
:language: dart

- id: java
content: |

.. literalinclude:: /examples/MissingPlaceholders/api.java
:language: java

- id: java-kotlin
content: |

.. literalinclude:: /examples/MissingPlaceholders/api-java-kotlin.kt
:language: kotlin

- id: javascript
content: |

.. literalinclude:: /examples/generated/node/authenticate.snippet.delete-user.js
:language: javascript

- id: kotlin
content: |

.. literalinclude:: /examples/generated/kotlin/AuthenticationTest.snippet.delete-user.kt
:language: kotlin

- id: objectivec
content: |

.. literalinclude:: /examples/MissingPlaceholders/example.m
:language: objectivec

- id: swift
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that the Swift examples have XCTAssert statements? Seems problematic for copy/paste. Probably not worth addressing as part of the consolidation work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is intentional as we were experimenting with different ways to show information in code examples. But it's a direction we decided not to take after this, and probably warrants being updated/removed. I can make it non copyable for now, and will update the Swift follow up ticket for this page to remove the asserts.

content: |

**Async/Await**

.. literalinclude:: /examples/generated/code/start/DeleteUsers.snippet.async-await-delete-user.swift
:language: swift
:copyable: false

**Closure-Style**

.. literalinclude:: /examples/generated/code/start/DeleteUsers.snippet.closure-delete-user.swift
:language: swift
:copyable: false

- id: typescript
content: |

.. literalinclude:: /examples/generated/node/authenticate.snippet.delete-user.js
:language: typescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.. tabs-drivers::

tabs:
- id: cpp-sdk
content: |

.. literalinclude:: /examples/MissingPlaceholders/api.cpp
:language: cpp

- id: csharp
content: |

.. literalinclude:: /examples/MissingPlaceholders/example.cs
:language: csharp

- id: dart
content: |

.. literalinclude:: /examples/MissingPlaceholders/example.dart
:language: dart

- id: java
content: |

.. literalinclude:: /examples/MissingPlaceholders/example.java
:language: java

- id: java-kotlin
content: |

.. literalinclude:: /examples/MissingPlaceholders/example-java-kotlin.kt
:language: kotlin

- id: javascript
content: |

.. literalinclude:: /examples/MissingPlaceholders/example.js
:language: javascript

- id: kotlin
content: |

.. literalinclude:: /examples/generated/kotlin/AuthenticationTest.snippet.remove-user.kt
:language: kotlin

- id: objectivec
content: |

.. literalinclude:: /examples/MissingPlaceholders/example.m
:language: objectivec

- id: swift
content: |

.. literalinclude:: /examples/MissingPlaceholders/example.swift
:language: swift

- id: typescript
content: |

.. literalinclude:: /examples/MissingPlaceholders/example.ts
:language: typescript
2 changes: 1 addition & 1 deletion source/sdk/users.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Manage Users
.. toctree::
:titlesonly:

Create and Delete Users </sdk/users/create-and-delete-users>
Create, Delete, & Remove Users </sdk/users/create-and-delete-users>
Authenticate Users </sdk/users/authenticate-users>
Custom User Data </sdk/users/custom-user-data>
User Metadata </sdk/users/user-metadata>
Expand Down
5 changes: 5 additions & 0 deletions source/sdk/users/authenticate-users.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ Offline Login

Refresh Token Expiration
------------------------

.. _sdks-logout:

Log a User Out
--------------
Loading
Loading