简体   繁体   English

firebase 处理角色的最佳方式

[英]firebase best way to handle roles

I am newbie looking for the best solution to create roles for users in firebase (subscriber, etc).我是新手,正在寻找为 firebase 中的用户(订阅者等)创建角色的最佳解决方案。 Do I create a user collection that is linked to the userid?我是否创建链接到用户 ID 的用户集合?

How do I incorporate it into a user signup:如何将其合并到用户注册中:

firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
  // ...
});

Since you mention creating a collection, I'll assume you're using Firestore.由于您提到创建集合,我假设您使用的是 Firestore。 In that case have a look a the Firestore documentation on role based access control , which shows how to use a combination of Firebase Authentication and Firebase's server-side security rules to control access to the data in your database.在这种情况下,请查看有关基于角色的访问控制的 Firestore 文档,其中展示了如何结合使用 Firebase 身份验证和 Firebase 的服务器端安全规则来控制对数据库中数据的访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM