如何在Firebase中授予不同类型的用户登录权限? [英] How to give different access to different type of user for login in Firebase?

查看:279
本文介绍了如何在Firebase中授予不同类型的用户登录权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Firebase作为数据库在Android上创建应用程序。我有三种不同类型的用户,即运营商,管理员,管理员,每个用户都希望给予他们不同的访问权限,如操作员,管理员可以查看和添加数据,而管理员可以添加/删除/查看数据。我尝试使用电子邮件& Firebase中的验证标签,但不允许设置用户的类型。 Firebase身份验证(就像它的名字一样)我们只需要帮助就如何为不同的用户提供不同的登录类型。

意味着)只是验证用户:它确保用户是他们说的那个人。它无法设置特定的用户类型。



要根据用户的身份限制用户的访问权限,需要为数据库编写规则。请参阅 https://firebase.google.com/docs/database/security/



您所描述的模型被称为基于角色的安全广告。阅读完文档后,我建议您搜索更多相关信息。

I am creating an application on Android in which I am using Firebase as a database. I have three different kinds of users in that which are operators, managers, administrators to each one I want to give different kinds of access to every one of them like operator, manager can view and add data whereas admin can add/delete/view data. I tried using email & auth tab in Firebase but it doesn't allow me to set the type of user on it. I just require help on the aspect on how do I have different login types for different users.

解决方案

Firebase Authentication (as its name implies) just authenticates the user: it ensures the user is who they say they are. It has no ability to set a specific user type.

To restrict access for user based on their identity requires that you write rules for your database. See https://firebase.google.com/docs/database/security/

The model you're describing is known as role-based security ad has been covered before. After reading the documentation, I recommend searching for more information on that.

这篇关于如何在Firebase中授予不同类型的用户登录权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆