Skip to content

Commit

Permalink
(DOCSP-39525): Consolidate Create and Delete Users page (#3289)
Browse files Browse the repository at this point in the history
## Pull Request Info - SDK Docs Consolidation

Jira ticket: https://jira.mongodb.org/browse/DOCSP-39525

*Staged Page*

- [Create, Delete, and Remove
Users](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39525/sdk/users/create-and-delete-users/)

*Page Source*

Add links to every SDK's pages where you got the SDK-specific
information:

- [Flutter: Delete a
User](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/users/delete-user/)
- [Java: Create and Delete
Users](https://www.mongodb.com/docs/atlas/device-sdks/sdk/java/users/create-delete-users/)
- [Kotlin: Delete
Users](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/users/delete-users/)
- [.NET: Create and Delete
Users](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/manage-users/create-and-delete-users/)
- [Node.js: Create and Delete
Users](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/users/create-delete-users/)
- [Swift: Create and Delete
Users](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/users/create-and-delete-users/)

### PR Author Checklist

Before requesting a review for your PR, please check these items:

- [x] Open the PR against the `feature-consolidated-sdk-docs` branch
instead of `master`
- [x] Tag the consolidated page for:
  - genre
  - meta.keywords
  - meta.description

#### Naming
- [x] Update Realm naming and the language around persistence
layer/local/device per [this
document](https://docs.google.com/document/d/126OczVxBWAwZ4P5ZsSM29WI3REvONEr1ald-mAwPtyQ/edit?usp=sharing)
- [x] Include `.rst` files comply with [the naming
guidelines](https://docs.google.com/document/d/1h8cr66zoEVeXytVfvDxlCSsUS5IZwvUQvfSCEXNMpek/edit#heading=h.ulh8b5f2hu9)

#### Links and Refs
- [x] Create new consolidated SDK ref targets starting with "_sdks-" for
relevant sections
- [x] Remove or update any SDK-specific refs to use the new consolidated
SDK ref targets
- [x] [Update any Kotlin API
links](https://jira.mongodb.org/browse/DOCSP-32519) to use the new
Kotlin SDK roles

#### Content
- [x] Shared code boxes have snippets or placeholders for all 9
languages
- [x] API description sections have API details or a generic placeholder
for all 9 languages
- [x] Check related pages for relevant content to include
- [x] Create a ticket for missing examples in each relevant SDK:
Consolidation Gaps epic

### Reviewer Checklist

As a reviewer, please check these items:

- [x] Shared code example boxes contain language-specific snippets or
placeholders for every language
- [x] API reference details contain working API reference links or
generic content
- [x] Realm naming/language has been updated
- [x] All relevant content from individual SDK pages is present on the
consolidated page
  • Loading branch information
dacharyc authored Jun 18, 2024
1 parent 8ee6c6b commit c33fc22
Show file tree
Hide file tree
Showing 22 changed files with 522 additions and 4 deletions.
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
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

0 comments on commit c33fc22

Please sign in to comment.