黑莓持久存储 +用户级别访问
我目前正在研究使用黑莓持久存储来保存信息。我必须根据用户级别访问权限保存详细信息。
场景:用户 1 已登录并将一些详细信息保存到持久性存储中,然后用户 2 登录。用户 1 保存的数据不应可供用户 2 使用。你能指导我如何解决这个问题吗?
我正在使用下面的代码。
try {
store = PersistentStore.getPersistentObject(key);
CodeSigningKey codeSigningKey = CodeSigningKey.get("ACME");
synchronized (store) {
objectsList = new Vector();
store.setContents(new ControlledAccess(objectsList,codeSigningKey));
store.commit();
}
} catch (Exception e) {
Dialog.inform(e.toString());
}
I am currently working on the saving the information using blackberry persistence store. I have to save the details according to the user level access.
Scenario: User 1 has logged in and saved some details to the persistence store, and then User2 logged in. The data saved by User1 should not be available for User2. Can you please guide me how do i fix that.
I am using the below code.
try {
store = PersistentStore.getPersistentObject(key);
CodeSigningKey codeSigningKey = CodeSigningKey.get("ACME");
synchronized (store) {
objectsList = new Vector();
store.setContents(new ControlledAccess(objectsList,codeSigningKey));
store.commit();
}
} catch (Exception e) {
Dialog.inform(e.toString());
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用用户名作为密钥为每个用户创建不同的持久存储,
因此您应该执行以下操作
You could create a different persistent store for each user by using the username as key
so what you should do is the following