<section class="field">
  {{#if category.is_special}}
    {{#if category.isUncategorizedCategory}}
      <p class="warning">{{i18n "category.uncategorized_security_warning"}}</p>
    {{else}}
      <p class="warning">{{i18n "category.special_warning"}}</p>
    {{/if}}
  {{/if}}

  {{#unless category.is_special}}
    <div class="category-permissions-table">
      <div class="permission-row row-header">
        <span class="group-name">{{i18n "category.permissions.group"}}</span>
        <span class="options">
          <span class="cell">{{i18n "category.permissions.see"}}</span>
          <span class="cell">{{i18n "category.permissions.reply"}}</span>
          <span class="cell">{{i18n "category.permissions.create"}}</span>
        </span>
      </div>
      {{#each category.permissions as |p|}}
        {{category-permission-row group_name=p.group_name type=p.permission_type category=category everyonePermission=everyonePermission}}
      {{/each}}

      {{#unless category.permissions}}
        <div class="permission-row row-empty">
          {{i18n "category.permissions.no_groups_selected"}}
        </div>
      {{/unless}}

      {{#if category.availableGroups}}
        <div class="add-group">
          <span class="group-name">
            {{combo-box
              class="available-groups"
              content=category.availableGroups
              onChange=(action "onSelectGroup")
              value=null
              valueProperty=null
              nameProperty=null
              options=(hash
                none="category.security_add_group"
              )
            }}
          </span>
        </div>
      {{/if}}
    </div>

    {{#if everyoneGrantedFull}}
      <p class="warning">{{i18n "category.permissions.everyone_has_access"}}</p>
    {{/if}}
  {{/unless}}
</section>

{{plugin-outlet name="category-custom-security" args=(hash category=category) connectorTagName="" tagName="section"}}
