I want to specify resource authorisation info in yml file. admin can create an employee and can only view company.
I used YAML::load method to load this file.
If i use - symbol for multiple permission (action, resource pair) it gives parsing error. If i remove - symbol then it only picks first action resource pair. I think load method expect 1 space indentation while parsing and if i specify - then one space indentation condition is violated that is reason for error. What is possible solution for this.
admin:
- action: create
resource: employee
- action: show
resource: company
admin:
action: create
resource: employee
action: show
resource: company
not sure if this helps, but when i try to load the first example, it works for me. Maybe the indentation is not correct?
anyway, this works here:
require "YAML"
something = YAML.load_file("admin.yaml")
oh yes, let me add the admin.yaml that works for me:
admin: - action: create resource: employee - action: show resource: company
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With