我真的需要firebase admin sdk来确定用户和admin的角色吗? [英] Do I really need firebase admin sdk to determine roles of user and admin?

查看:47
本文介绍了我真的需要firebase admin sdk来确定用户和admin的角色吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否真的需要firebase admin sdk来确定用户和admin的角色,还是仍然可以将角色作为具有数组数据类型的字段来进行操作,然后我将确定该用户是否只是普通用户还是管理员?

Do I really need firebase admin sdk to determine roles of user and admin or can I still do it with roles as a field with a datatype of an array and based on that I'll determine if the user is just a regular user or an admin?

推荐答案

您可以很好地将基于用户角色的访问权限策略基于Firestore文档而不是基于自定义声明".在这种情况下,您不需要Admin SDK.但是,您必须注意,安全规则正确地保护声明了访问权限的集合/文档!

You can very well base your user roles based access rights strategy on Firestore documents and not on Custom Claims. In this case you don't need the Admin SDK. You have to take care, however, that your security rules correctly protect the collections/docs where the access rights are declared!

您会在 doc 以及以下

You will find some examples in the doc as well as in the following article (for user groups).

这篇关于我真的需要firebase admin sdk来确定用户和admin的角色吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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