Domanda

Nei miei infissi ACL non ho le risorse e le azioni, la maggior parte delle risorse condividono azioni comuni come CRUD, c'è un modo in Dottrina (YAML) per estendere un altro elemento?

Ecco un trafiletto dal mio YAML corrente:


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

Come potrei estendere R1 con una nuova risorsa, chiamata 'News article' per esempio, che avrebbe ereditato da A1 a A4 + comprendono le sue proprie azioni?

È stato utile?

Soluzione

"Ancore e Alias" + Merge è la risposta:

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

(Usa http://instantyaml.appspot.com/ per vedere come il YAML canonica si presenta come )

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top