mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Team permission allow different unit has different permission (#17811)
* Team permission allow different unit has different permission * Finish the interface and the logic * Fix lint * Fix translation * align center for table cell content * Fix fixture * merge * Fix test * Add deprecated * Improve code * Add tooltip * Fix swagger * Fix newline * Fix tests * Fix tests * Fix test * Fix test * Max permission of external wiki and issues should be read * Move team units with limited max level below units table * Update label and column names * Some improvements * Fix lint * Some improvements * Fix template variables * Add permission docs * improve doc * Fix fixture * Fix bug * Fix some bug * fix * gofumpt * Integration test for migration (#18124) integrations: basic test for Gitea {dump,restore}-repo This is a first step for integration testing of DumpRepository and RestoreRepository. It: runs a Gitea server, dumps a repo via DumpRepository to the filesystem, restores the repo via RestoreRepository from the filesystem, dumps the restored repository to the filesystem, compares the first and second dump and expects them to be identical The verification is trivial and the goal is to add more tests for each topic of the dump. Signed-off-by: Loïc Dachary <loic@dachary.org> * Team permission allow different unit has different permission * Finish the interface and the logic * Fix lint * Fix translation * align center for table cell content * Fix fixture * merge * Fix test * Add deprecated * Improve code * Add tooltip * Fix swagger * Fix newline * Fix tests * Fix tests * Fix test * Fix test * Max permission of external wiki and issues should be read * Move team units with limited max level below units table * Update label and column names * Some improvements * Fix lint * Some improvements * Fix template variables * Add permission docs * improve doc * Fix fixture * Fix bug * Fix some bug * Fix bug Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Aravinth Manivannan <realaravinth@batsense.net>
This commit is contained in:
@@ -56,21 +56,14 @@
|
||||
<br>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="permission" value="read" {{if or .PageIsOrgTeamsNew (eq .Team.Authorize 1)}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "org.teams.read_access"}}</label>
|
||||
<span class="help">{{.i18n.Tr "org.teams.read_access_helper"}}</span>
|
||||
<input type="radio" name="permission" value="{{if .PageIsOrgTeamsNew}}read{{else}}{{.Team.AccessMode}}{{end}}" {{if or .PageIsOrgTeamsNew (eq .Team.AccessMode 1) (eq .Team.AccessMode 2)}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "org.teams.general_access"}}</label>
|
||||
<span class="help">{{.i18n.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.Authorize 2}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "org.teams.write_access"}}</label>
|
||||
<span class="help">{{.i18n.Tr "org.teams.write_access_helper"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="permission" value="admin" {{if eq .Team.Authorize 3}}checked{{end}}>
|
||||
<input type="radio" name="permission" value="admin" {{if eq .Team.AccessMode 3}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "org.teams.admin_access"}}</label>
|
||||
<span class="help">{{.i18n.Tr "org.teams.admin_access_helper"}}</span>
|
||||
</div>
|
||||
@@ -78,24 +71,66 @@
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<div class="team-units required grouped field"{{if eq .Team.Authorize 3}} style="display: none"{{end}}>
|
||||
<div class="team-units required grouped field"{{if eq .Team.AccessMode 3}} style="display: none"{{end}}>
|
||||
<label>{{.i18n.Tr "org.team_unit_desc"}}</label>
|
||||
<br>
|
||||
<table class="ui celled table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="center aligned">{{.i18n.Tr "units.unit"}}</th>
|
||||
<th class="center aligned">{{.i18n.Tr "org.teams.none_access"}}
|
||||
<i class="circle help icon link tooltip" data-content="{{.i18n.Tr "org.teams.none_access_helper"}}"></i></th>
|
||||
<th class="center aligned">{{.i18n.Tr "org.teams.read_access"}}
|
||||
<i class="circle help icon link tooltip" data-content="{{.i18n.Tr "org.teams.read_access_helper"}}"></i>
|
||||
</th>
|
||||
<th class="center aligned">{{.i18n.Tr "org.teams.write_access"}}
|
||||
<i class="circle help icon link tooltip" data-content="{{.i18n.Tr "org.teams.write_access_helper"}}"></i>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $t, $unit := $.Units}}
|
||||
{{if ge $unit.MaxPerms 2}}
|
||||
<tr>
|
||||
<td>
|
||||
<div {{if $unit.Type.UnitGlobalDisabled}}class="field tooltip" data-content="{{$.i18n.Tr "repo.unit_disabled"}}">{{- else -}}class="field"{{end}}>
|
||||
<div class="ui">
|
||||
<label>{{$.i18n.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{$.i18n.Tr "org.team_unit_disabled"}}{{end}}</label>
|
||||
<span class="help">{{$.i18n.Tr $unit.DescKey}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="center aligned">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" class="hidden" name="unit_{{$unit.Type.Value}}" value="0"{{if or ($unit.Type.UnitGlobalDisabled) (eq ($.Team.UnitAccessMode $unit.Type) 0)}} checked{{end}}>
|
||||
</div>
|
||||
</td>
|
||||
<td class="center aligned">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" class="hidden" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}}>
|
||||
</div>
|
||||
</td>
|
||||
<td class="center aligned">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" class="hidden" name="unit_{{$unit.Type.Value}}" value="2"{{if (eq ($.Team.UnitAccessMode $unit.Type) 2)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}}>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{range $t, $unit := $.Units}}
|
||||
{{if $unit.Type.UnitGlobalDisabled}}
|
||||
<div class="field tooltip" data-content="{{$.i18n.Tr "repo.unit_disabled"}}">
|
||||
{{else}}
|
||||
<div class="field">
|
||||
{{end}}
|
||||
<div class="ui toggle checkbox">
|
||||
<input type="checkbox" class="hidden" name="units" value="{{$unit.Type.Value}}"{{if or (eq $.Team.ID 0) ($.Team.UnitEnabled $unit.Type)}} checked{{end}}>
|
||||
<label>{{$.i18n.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{$.i18n.Tr "org.team_unit_disabled"}}{{end}}</label>
|
||||
<span class="help">{{$.i18n.Tr $unit.DescKey}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{if lt $unit.MaxPerms 2}}
|
||||
<div {{if $unit.Type.UnitGlobalDisabled}}class="field tooltip" data-content="{{$.i18n.Tr "repo.unit_disabled"}}"{{else}}class="field"{{end}}>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" class="hidden" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}}>
|
||||
<label>{{$.i18n.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{$.i18n.Tr "org.team_unit_disabled"}}{{end}}</label>
|
||||
<span class="help">{{$.i18n.Tr $unit.DescKey}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
{{end}}
|
||||
|
||||
<div class="field">
|
||||
|
@@ -29,19 +29,19 @@
|
||||
<div class="item">
|
||||
{{if eq .Team.LowerName "owners"}}
|
||||
{{.i18n.Tr "org.teams.owners_permission_desc" | Str2html}}
|
||||
{{else if (eq .Team.Authorize 1)}}
|
||||
{{else if (eq .Team.AccessMode 1)}}
|
||||
{{if .Team.IncludesAllRepositories}}
|
||||
{{.i18n.Tr "org.teams.all_repositories_read_permission_desc" | Str2html}}
|
||||
{{else}}
|
||||
{{.i18n.Tr "org.teams.read_permission_desc" | Str2html}}
|
||||
{{end}}
|
||||
{{else if (eq .Team.Authorize 2)}}
|
||||
{{else if (eq .Team.AccessMode 2)}}
|
||||
{{if .Team.IncludesAllRepositories}}
|
||||
{{.i18n.Tr "org.teams.all_repositories_write_permission_desc" | Str2html}}
|
||||
{{else}}
|
||||
{{.i18n.Tr "org.teams.write_permission_desc" | Str2html}}
|
||||
{{end}}
|
||||
{{else if (eq .Team.Authorize 3)}}
|
||||
{{else if (eq .Team.AccessMode 3)}}
|
||||
{{if .Team.IncludesAllRepositories}}
|
||||
{{.i18n.Tr "org.teams.all_repositories_admin_permission_desc" | Str2html}}
|
||||
{{else}}
|
||||
|
@@ -14049,6 +14049,14 @@
|
||||
"repo.projects",
|
||||
"repo.ext_wiki"
|
||||
]
|
||||
},
|
||||
"units_map": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "UnitsMap",
|
||||
"example": "{\"repo.code\":\"read\",\"repo.issues\":\"write\",\"repo.ext_issues\":\"none\",\"repo.wiki\":\"admin\",\"repo.pulls\":\"owner\",\"repo.releases\":\"none\",\"repo.projects\":\"none\",\"repo.ext_wiki\":\"none\"]"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
@@ -14860,6 +14868,14 @@
|
||||
"repo.projects",
|
||||
"repo.ext_wiki"
|
||||
]
|
||||
},
|
||||
"units_map": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "UnitsMap",
|
||||
"example": "{\"repo.code\":\"read\",\"repo.issues\":\"write\",\"repo.ext_issues\":\"none\",\"repo.wiki\":\"admin\",\"repo.pulls\":\"owner\",\"repo.releases\":\"none\",\"repo.projects\":\"none\",\"repo.ext_wiki\":\"none\"]"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
@@ -17453,6 +17469,14 @@
|
||||
"repo.projects",
|
||||
"repo.ext_wiki"
|
||||
]
|
||||
},
|
||||
"units_map": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "UnitsMap",
|
||||
"example": "{\"repo.code\":\"read\",\"repo.issues\":\"write\",\"repo.ext_issues\":\"none\",\"repo.wiki\":\"admin\",\"repo.pulls\":\"owner\",\"repo.releases\":\"none\",\"repo.projects\":\"none\",\"repo.ext_wiki\":\"none\"]"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
|
Reference in New Issue
Block a user