<p class="well-sm" translate="document.view.permissions.message"></p>

<div class="well">
  <h3>{{ 'document.view.permissions.title' | translate }}</h3>

  <acl-edit source="document.id"
            acls="document.acls"
            writable="document.writable"
            creator="document.creator"></acl-edit>
</div>

<div class="well" ng-show="document.inherited_acls.length > 0">
  <h3>{{ 'document.view.permissions.inherited_tags' | translate }}</h3>

  <table class="table table-permissions">
    <tr>
      <th style="width: 30%">{{ 'document.view.permissions.acl_source' | translate }}</th>
      <th style="width: 30%">{{ 'document.view.permissions.acl_target' | translate }}</th>
      <th style="width: 30%">{{ 'document.view.permissions.acl_permission' | translate }}</th>
    </tr>

    <tr ng-repeat="(id, acl) in inheritedAcls">
      <td>
        <a href="#/tag/{{ acl[0].source_id }}">
          <span class="fas fa-tags" ng-style="{ 'color': acl[0].source_color }"></span>&nbsp;
          {{ acl[0].source_name }}
        </a>
      </td>
      <td><acl data="acl[0]"></acl></td>
      <td>
        <span class="label label-default label-acl" ng-repeat="a in acl | orderBy: 'perm'">
          {{ 'acl.' + a.perm | translate }}
        </span>
      </td>
    </tr>
  </table>
</div>