Pregunta

En mis accesorios ACL tengo recursos y acciones, la mayor parte de los recursos comparten acciones comunes como ABM, hay una manera en Doctrina (yaml) para extender otro elemento?

Esta es una propaganda de mi yaml actual:


Resource:
  R1:
    title: Article
    system_name: ARTICLE
    Actions:
        A1:
            title: Create
            system_name: CREATE
        A2:
            title: Read
            system_name: READ
        A3:
            title: Update
            system_name: UPDATE
        A4:
            title: Delete
            system_name: DELETE

¿Cómo podría extender R1 con un nuevo recurso, llamado 'Reportaje', por ejemplo, que heredaría A1 a A4 + incluyen acciones propias es?

¿Fue útil?

Solución

"anclas y alias" + Merge es la respuesta:

http://yaml.github.com/yaml-spec/#id2768357

(Uso http://instantyaml.appspot.com/ para ver cómo el YAML canónica parece )

Resource:
  R1:
    title: Article
    system_name: ARTICLE
    Actions: &id1
        A1:
            title: Create
            system_name: CREATE
        A2:
            title: Read
            system_name: READ
  R2:
    system_name: New ARTICLE
    Actions:
       <<: *id1
       A5:
            title: Drop
            system_name: DROP
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top