DB Rules

Security rules from a database

CBSecurity also allows you to store your security rules in a database as long as all the columns match the keys of the rules as we saw in the rule anatomy.

You will use the db as the source and fill out the available db properties:

config/Coldbox.cfc
// CB Security
cbSecurity : {
  firewall : {
    rules : {
      provider : {
        "source" : "db",
        "properties" : {
            "dsn" : "myapp",
            "sql" : "",
            "table" : "securityRules",
            "orderBy" : "order asc"
        }
      }
    }
  }
}
  • The dsn property is the name of the datasource to use

  • The table property is what table the rules are stored in

  • The orderBy property is what order by SQL to use, by default it is empty

  • The sql property is what SQL to execute to retrieve the rules. The default is select * from ${table}

Last updated