{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings collaboration")}}

{{.locale.Tr "repo.settings.collaboration"}}

{{if .Collaborators}}
{{range .Collaborators}}
{{svg "octicon-shield-lock"}}
{{end}}
{{end}}
{{.CsrfTokenHtml}}
{{if .RepoOwnerIsOrganization}}

{{$.locale.Tr "repo.settings.teams"}}

{{$allowedToChangeTeams := (or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}} {{if .Teams}}
{{range $t, $team := .Teams}}
{{svg "octicon-shield-lock"}} {{if or (eq .AccessMode 1) (eq .AccessMode 2)}} {{$first := true}}
Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $.Context $unit.Type) ($team.UnitEnabled $.Context $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{$.locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}}
{{end}}
{{if $allowedToChangeTeams}}
{{end}}
{{end}}
{{end}}
{{if $allowedToChangeTeams}}
{{.CsrfTokenHtml}}
{{else}}
{{$.locale.Tr "repo.settings.change_team_access_not_allowed"}}
{{end}}
{{end}}
{{template "repo/settings/layout_footer" .}}