mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-20 01:08:36 +00:00
enhance: inherit team access for all units (#38938)
Admin and write team authorize now grant that mode on every unit, including units added later, instead of only rows present in `team_unit`. Granular teams keep `authorize=none` and explicit unit rows. Closes the `TEAM-UNIT-PERMISSION` design gap from https://github.com/go-gitea/gitea/pull/34128. Maybe also fix #15962 (actually maybe it had been fixed before, the root cause is out-of-sync "access" table) ## Screenshots only writing selected: <img width="1399" height="1007" alt="image" src="https://github.com/user-attachments/assets/1d1b4c49-a59a-47b6-998f-0464a067395b" /> _Created with the help of AI_ --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -95,11 +95,18 @@
|
||||
<br>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="permission" value="read" {{if or .PageIsOrgTeamsNew (eq .Team.AccessMode 0) (eq .Team.AccessMode 1) (eq .Team.AccessMode 2)}}checked{{end}}>
|
||||
<input type="radio" name="permission" value="none" {{if or .PageIsOrgTeamsNew (eq .Team.AccessMode 0) (eq .Team.AccessMode 1)}}checked{{end}}>
|
||||
<label>{{ctx.Locale.Tr "org.teams.general_access"}}</label>
|
||||
<span class="help">{{ctx.Locale.Tr "org.teams.general_access_helper"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="permission" value="write" {{if eq .Team.AccessMode 2}}checked{{end}}>
|
||||
<label>{{ctx.Locale.Tr "org.teams.write_access"}}</label>
|
||||
<span class="help">{{ctx.Locale.Tr "org.teams.write_access_all_helper"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="permission" value="admin" {{if eq .Team.AccessMode 3}}checked{{end}}>
|
||||
@@ -110,7 +117,7 @@
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="team-units required grouped field {{if eq .Team.AccessMode 3}}tw-hidden{{end}}">
|
||||
<div class="team-units required grouped field {{if ge .Team.AccessMode 2}}tw-hidden{{end}}">
|
||||
<label>{{ctx.Locale.Tr "org.team_unit_desc"}}</label>
|
||||
<table class="ui celled table">
|
||||
<thead>
|
||||
|
||||
@@ -50,12 +50,10 @@
|
||||
<li>{{ctx.Locale.Tr "org.teams.can_create_org_repo"}}</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{/* the AccessMode should be either none or admin/owner, the real permissions are provided by each team unit */}}
|
||||
{{if false}}{{/*(eq .Team.AccessMode 2)*/}}
|
||||
{{if (eq .Team.AccessMode 2)}}
|
||||
<h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3>
|
||||
{{ctx.Locale.Tr "org.teams.write_permission_desc"}}
|
||||
{{else if (eq .Team.AccessMode 3)}}
|
||||
{{/* FIXME: here might not right, see "FIXME: TEAM-UNIT-PERMISSION", new units might not have correct admin permission*/}}
|
||||
{{else if (ge .Team.AccessMode 3)}}
|
||||
<h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3>
|
||||
{{ctx.Locale.Tr "org.teams.admin_permission_desc"}}
|
||||
{{else}}
|
||||
|
||||
@@ -62,23 +62,20 @@
|
||||
{{.Name}}
|
||||
</a>
|
||||
<div class="item-body flex-text-block">
|
||||
{{/*FIXME: TEAM-UNIT-PERMISSION this display is not right, search the fixme keyword to see more details */}}
|
||||
{{svg "octicon-shield-lock"}}
|
||||
{{if eq .AccessMode 0}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.per_unit"}}
|
||||
{{else if eq .AccessMode 1}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.read"}}
|
||||
{{if ge .AccessMode 4}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.owner"}}
|
||||
{{else if ge .AccessMode 3}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}
|
||||
{{else if eq .AccessMode 2}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.write"}}
|
||||
{{else if eq .AccessMode 3}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}
|
||||
{{else if eq .AccessMode 4}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.owner"}}
|
||||
{{else if eq .AccessMode 1}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.read"}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.undefined"}}
|
||||
{{ctx.Locale.Tr "repo.settings.collaboration.per_unit"}}
|
||||
{{end}}
|
||||
</div>
|
||||
{{if or (eq .AccessMode 0) (eq .AccessMode 1) (eq .AccessMode 2)}}
|
||||
{{if lt .AccessMode 2}}
|
||||
{{$first := true}}
|
||||
<div class="item-body" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.change_team_permission_tip"}}">
|
||||
Units:
|
||||
|
||||
+12
-2
@@ -4879,7 +4879,12 @@
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"permission": {
|
||||
"$ref": "#/components/schemas/RepoWritePermission"
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/RepoWritePermission"
|
||||
}
|
||||
],
|
||||
"description": "All units have this permission (read/write/admin)"
|
||||
},
|
||||
"units": {
|
||||
"deprecated": true,
|
||||
@@ -6129,7 +6134,12 @@
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"permission": {
|
||||
"$ref": "#/components/schemas/RepoWritePermission"
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/RepoWritePermission"
|
||||
}
|
||||
],
|
||||
"description": "All units have this permission (read/write/admin)"
|
||||
},
|
||||
"units": {
|
||||
"deprecated": true,
|
||||
|
||||
+2
@@ -27790,6 +27790,7 @@
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"permission": {
|
||||
"description": "All units have this permission (read/write/admin)",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"read",
|
||||
@@ -29060,6 +29061,7 @@
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"permission": {
|
||||
"description": "All units have this permission (read/write/admin)",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"read",
|
||||
|
||||
Reference in New Issue
Block a user