有没有办法在 firebase 存储规则中验证用户角色?

is there a way to authenticate user role in firebase storage rules?

我正在尝试根据用户角色限制 firebase 存储。

Database:
    users
        <uid>
            admin=false
            ... ... ...

我正在尝试在 firebase 存储中使用以下类型的规则:

root.child('users').child(auth.uid).child('user').child('admin').val() == true

将此添加到写入规则后,访问被拒绝。

谢谢。

正如 Frank van Puffelen 在他的评论中指出的那样:

function isAdminUser() {
    return request.auth.uid in {
        "yaddayadddayaddUserIDKey":"User Name1"
    };
}

service firebase.storage {
    match /b/<appName>.appspot.com/o {
        match /{allPaths=**} {
            allow read;
            allow write: if request.auth != null && isAdminUser();
        }
   }
}