Create group access to firebase storage without using custom authorization

前端 未结 2 1060
春和景丽
春和景丽 2020-12-09 00:34

Is there a way to control uploads to a path in Firebase Storage by group? For instance have an admin group that can upload anywhere or a team that can only upload to a certa

2条回答
  •  独厮守ぢ
    2020-12-09 00:52

    I don't have enough reputation to comment on @ecalvo's answer. So I am adding an answer. The function isAdmin() can be provided a list as following:

    function isAdmin() {
       return request.auth !=null && request.auth.uid in [
            "uidAdmin1",
            "uidAdmin2",
            "uidOfOtherAdminsAsCommaSeparatedStrings"
        ];
    }
    

    Rest of the implementation can be borrowed from the answer of @ecalvo. I feel now it is more clear. In the answer of @ecalvo, I was confused why should I give username when I have to compare only uid.

提交回复
热议问题