首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >firebase setPriority permisions_denied

firebase setPriority permisions_denied
EN

Stack Overflow用户
提问于 2014-04-06 01:12:41
回答 1查看 229关注 0票数 1

文档:https://www.firebase.com/docs/javascript/firebase/setpriority.html

有没有遗漏什么重要的东西?

我正在尝试通过某个身份验证用户更新组的优先级。只有当我被认证为组的所有者时,我才能这样做,并且我不知道为什么以及如何像我对"membersCount“所做的那样,只为更新优先级的所有身份验证用户授予访问权限。

代码语言:javascript
复制
// GROUPS
"groups": {
  "$subCategoryId": {      
    "$groupId": {
      // ONLY OWNER OF GROUP CAN UPDATE THE userId, name, hashTag, categoryId
      // 
      // The first init has to have userId, name, categoryId
      // 
      // Anyone can update the membersCount
      ".write": "newData.hasChildren(['userId','name','categoryId']) || !data.exists() || auth != null",
      "userId": {
        ".validate": "auth.uid == newData.val()"
      },
      "name": {
        ".validate": "newData.val() != '' && newData.val().length < 30 && (data.parent().child('userId').val() == auth.uid || !data.parent().child('userId').exists())"
      },
      "hashTag": {
        ".validate": "(data.parent().child('userId').val() == auth.uid || !data.parent().child('userId').exists())"
      },
      "categoryId": {
        ".validate": "newData.val() != '' && root.child('categories').child(newData.val()).exists() && root.child('subcategories').child(newData.val()).child($subCategoryId).exists() && (data.parent().child('userId').val() == auth.uid || !data.parent().child('userId').exists())"
      },
      "membersCount": {
        ".write": "auth != null && newData.isNumber() && (data.val()+1 == newData.val() || data.val()-1 == newData.val() )"  
      }
    }
  }    
},

当我尝试更新({ '.priority':2})时,我得到:

未捕获的错误: update()当前不支持更新.priority。

EN

回答 1

Stack Overflow用户

发布于 2014-04-10 01:47:46

在这种情况下,错误消息与安全规则无关。不能使用update()命令更新优先级。您可以使用setPriority(2)来完成此操作。

如果您想在安全规则中引用优先级,可以使用getPriority来实现。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22884063

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档