如何使用 userId 销毁 JSONstore

How to destroy a JSONstore with userId

我的 JSONStore 将在同一台设备上存储多个用户数据,每个用户都有自己的用户名和密码。

如果其中一位用户忘记了 his/her 密码,我需要使用 userId 销毁 his/her JSONStore 数据,同时保持其他用户的完整。

这可能吗?

我对 IBM MobileFirst 中的 JSONStore 的了解是:

  1. 我有一个函数可以销毁所有 JSONstore

  2. 登录后只能销毁特定的JSONStore(但用户已经忘记密码,无法登录)

在我看来,因为忘记了密码而销毁用户数据有点过激,我们不是在詹姆斯邦德电影中。 :-)

  • 有一个 API 方法可以更改密码,因此例如当用户设置一个帐户(一个 JSONStore)时 s/he 也会回答一个问题。您将在另一个 JSONStore 中存储用户名和相关的问题和答案,public 或受内部 username/password 保护。例如,如果用户忘记了 his/her 密码并尝试登录三次,请询问安全问题,如果回答正确,则提供使用 changePassword API method (read more here 更改特定用户的 JSONStore 密码的选项。 3次同样失败,销毁JSONStore

  • 确实可以销毁特定用户的 JSONStore,而且您根本不需要先登录才能执行此操作。 destroy API 方法也接受可选参数,其中之一是您要销毁的特定 JSONStore 的用户名。 See the destroy API method 在 MobileFirst Platform Foundation 7.0 用户文档中。

destroy

{Promise} destroy(username, options)

Completely wipes data for all users, destroys the internal storage, and clears security artifacts.

Parameters:

{string} username Optional - Only removes data that is related to the specific username that is passed.