<mxfile host="app.diagrams.net" agent="claude-code-byan" type="device">
  <diagram name="MLD - RBAC" id="mld-rbac">
    <mxGraphModel dx="1400" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="826" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />

        <mxCell id="t_user" value="&lt;b&gt;user&lt;/b&gt;&lt;hr&gt;&lt;u&gt;PK id : INT UNSIGNED AUTO_INCREMENT&lt;/u&gt;&lt;br&gt;UK email : VARCHAR(254)&lt;br&gt;password_hash : VARCHAR(255)&lt;br&gt;nom : VARCHAR(60)&lt;br&gt;prenom : VARCHAR(60)&lt;br&gt;FK role_id : INT UNSIGNED&lt;br&gt;est_actif : TINYINT(1) DEFAULT 1&lt;br&gt;last_login_at : DATETIME NULL&lt;br&gt;created_at : DATETIME&lt;br&gt;updated_at : DATETIME" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;verticalAlign=top;fontSize=11;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="40" y="60" width="320" height="220" as="geometry" />
        </mxCell>

        <mxCell id="t_role" value="&lt;b&gt;role&lt;/b&gt;&lt;hr&gt;&lt;u&gt;PK id : INT UNSIGNED AUTO_INCREMENT&lt;/u&gt;&lt;br&gt;UK code : VARCHAR(40)&lt;br&gt;libelle : VARCHAR(80)&lt;br&gt;description : TEXT NULL&lt;br&gt;est_actif : TINYINT(1) DEFAULT 1&lt;br&gt;created_at : DATETIME&lt;br&gt;updated_at : DATETIME" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;verticalAlign=top;fontSize=11;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="440" y="60" width="320" height="160" as="geometry" />
        </mxCell>

        <mxCell id="t_permission" value="&lt;b&gt;permission&lt;/b&gt;&lt;hr&gt;&lt;u&gt;PK id : INT UNSIGNED AUTO_INCREMENT&lt;/u&gt;&lt;br&gt;UK code : VARCHAR(60) format resource.action&lt;br&gt;libelle : VARCHAR(120)&lt;br&gt;description : TEXT NULL&lt;br&gt;created_at : DATETIME" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;verticalAlign=top;fontSize=11;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="840" y="60" width="320" height="140" as="geometry" />
        </mxCell>

        <mxCell id="t_role_permission" value="&lt;b&gt;role_permission&lt;/b&gt; (jointure)&lt;hr&gt;&lt;u&gt;PK FK role_id : INT UNSIGNED&lt;/u&gt;&lt;br&gt;&lt;u&gt;PK FK permission_id : INT UNSIGNED&lt;/u&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;align=left;verticalAlign=top;fontSize=11;spacingLeft=8;spacingTop=4;dashed=1" vertex="1" parent="1">
          <mxGeometry x="600" y="380" width="320" height="100" as="geometry" />
        </mxCell>

        <mxCell id="fk_user_role" style="endArrow=open;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle" edge="1" parent="1" source="t_user" target="t_role">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="fk_user_role_lbl" value="FK ON DELETE RESTRICT" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=10;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="fk_user_role">
          <mxGeometry relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>

        <mxCell id="fk_rp_role" style="endArrow=open;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle" edge="1" parent="1" source="t_role_permission" target="t_role">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="fk_rp_role_lbl" value="FK ON DELETE CASCADE" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=10;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="fk_rp_role">
          <mxGeometry relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>

        <mxCell id="fk_rp_perm" style="endArrow=open;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle" edge="1" parent="1" source="t_role_permission" target="t_permission">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="fk_rp_perm_lbl" value="FK ON DELETE CASCADE" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=10;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="fk_rp_perm">
          <mxGeometry relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>

        <mxCell id="note_rbac" value="&lt;b&gt;Modele RBAC&lt;/b&gt;&lt;br&gt;Roles : dynamiques (CRUD admin UI), table principale role.&lt;br&gt;Permissions : statiques (declarees en migration), pas d'updated_at.&lt;br&gt;Mapping role-permission : matrice editable depuis l'UI admin.&lt;br&gt;Voir docs/notes/rbac-roles-permissions.md." style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;align=left;verticalAlign=top;fontSize=10;spacingLeft=8;spacingTop=4;dashed=1" vertex="1" parent="1">
          <mxGeometry x="40" y="380" width="500" height="100" as="geometry" />
        </mxCell>

        <mxCell id="legende" value="&lt;b&gt;Legende&lt;/b&gt;&lt;br&gt;&lt;u&gt;PK&lt;/u&gt; : cle primaire (composite si plusieurs lignes soulignees)&lt;br&gt;FK : cle etrangere (fleche -&gt; table referencee)&lt;br&gt;UK : contrainte unique&lt;br&gt;Bleu = table principale&lt;br&gt;Jaune pointille = table de jointure" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;align=left;verticalAlign=top;fontSize=10;spacingLeft=8;spacingTop=4;dashed=1" vertex="1" parent="1">
          <mxGeometry x="40" y="540" width="500" height="120" as="geometry" />
        </mxCell>

      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
