Giter VIP home page Giter VIP logo

wdog's Introduction

命令行输入 wdog ,即可看到帮助提示

wdog rp 可以部署新的规则,规则wdog_rules.coffee是一个coffeescript文件,可以使用变量。 比如:

USER_IS_ADMIN = "root.child('group').child('admin').child(auth.uid).val() == true"

GROUP_ADMIN_RW = "#{USER_IS_ADMIN} || (!root.hasChildren(['group','admin']))"


module.exports = \
{
    rules: {
        ".read": true,
        ".write": true,
        group:
            admin: {
                ".read": GROUP_ADMIN_RW
                ".write": GROUP_ADMIN_RW
                ".validate" : "newData.isNumber() && newData.val().isBoolean()"
            }
        admin_log:{
            ".read": USER_IS_ADMIN
            ".write": USER_IS_ADMIN
        }
    }
}

为了少打引号,也可以用类似 _write 替代 ".write" 等等,上传工具会自动处理转换,比如

USER_IS_ADMIN = "root.child('group').child('admin').child(auth.uid).val() == true"

GROUP_ADMIN_RW = "#{USER_IS_ADMIN} || (!root.hasChildren(['group','admin']))"

module.exports = \
{
    rules: {
        _read: true,
        _write: true,
        group:
            admin: {
                _read: GROUP_ADMIN_RW
                _write: GROUP_ADMIN_RW
                _validate : "newData.isNumber() && newData.val().isBoolean()"
            }
        admin_log:{
            _read: USER_IS_ADMIN
            _write: USER_IS_ADMIN
        }
    }
}

wdog's People

Contributors

noman798 avatar stackovermind avatar

Stargazers

 avatar

Watchers

 avatar  avatar

wdog's Issues

关于 $ 可能带来困扰

在野狗的安全规则中 $ 是保留字,代表这是一个通配的变量。$write 的写法可能会给用户造成困扰,如何解决?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.