mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-22 08:33:07 +02:00
Feedback
This commit is contained in:
parent
dcf43af234
commit
ba3a3a7086
@ -183,7 +183,7 @@ const (
|
||||
// ActionsTokenPermissions defines the permissions for different repository units
|
||||
type ActionsTokenPermissions struct {
|
||||
// Code (repository code) - read/write/none
|
||||
Code perm.AccessMode `json:"contents"`
|
||||
Code perm.AccessMode `json:"code"`
|
||||
// Issues - read/write/none
|
||||
Issues perm.AccessMode `json:"issues"`
|
||||
// PullRequests - read/write/none
|
||||
@ -206,7 +206,7 @@ func (p ActionsTokenPermissions) HasAccess(scope string, required perm.AccessMod
|
||||
switch scope {
|
||||
case "actions":
|
||||
mode = p.Actions
|
||||
case "contents":
|
||||
case "code":
|
||||
mode = p.Code
|
||||
case "issues":
|
||||
mode = p.Issues
|
||||
|
||||
@ -3741,8 +3741,8 @@
|
||||
"actions.general.token_permissions.access_none": "None",
|
||||
"actions.general.token_permissions.access_read": "Read",
|
||||
"actions.general.token_permissions.access_write": "Write",
|
||||
"actions.general.token_permissions.contents": "Code",
|
||||
"actions.general.token_permissions.contents.description": "Repository contents, commits, branches, downloads, releases, and merges.",
|
||||
"actions.general.token_permissions.code": "Code",
|
||||
"actions.general.token_permissions.code.description": "Repository contents, commits, branches, downloads, releases, and merges.",
|
||||
"actions.general.token_permissions.issues": "Issues",
|
||||
"actions.general.token_permissions.issues.description": "Issues and related comments, assignees, labels, and milestones.",
|
||||
"actions.general.token_permissions.pull_requests": "Pull Requests",
|
||||
|
||||
@ -18,8 +18,8 @@ const (
|
||||
tplSettingsActionsGeneral templates.TplName = "org/settings/actions_general"
|
||||
)
|
||||
|
||||
// ActionsGeneral renders the actions general settings page
|
||||
func ActionsGeneral(ctx *context.Context) {
|
||||
// ActionsGeneralSettings renders the actions general settings page
|
||||
func ActionsGeneralSettings(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("actions.actions")
|
||||
ctx.Data["PageIsOrgSettings"] = true
|
||||
ctx.Data["PageIsOrgSettingsActionsGeneral"] = true
|
||||
@ -58,12 +58,13 @@ func ActionsGeneral(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
ctx.Data["AllowedRepos"] = allowedRepos
|
||||
ctx.Data["Link"] = ctx.Org.OrgLink + "/settings/actions/general"
|
||||
|
||||
ctx.HTML(http.StatusOK, tplSettingsActionsGeneral)
|
||||
}
|
||||
|
||||
// ActionsGeneralPost responses for actions general settings page
|
||||
func ActionsGeneralPost(ctx *context.Context) {
|
||||
// UpdateTokenPermissions responses for actions general settings page
|
||||
func UpdateTokenPermissions(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("actions.actions")
|
||||
ctx.Data["PageIsOrgSettings"] = true
|
||||
ctx.Data["PageIsOrgSettingsActions"] = true
|
||||
@ -97,7 +98,7 @@ func ActionsGeneralPost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
actionsCfg.MaxTokenPermissions = &repo_model.ActionsTokenPermissions{
|
||||
Code: parseMaxPerm("contents"),
|
||||
Code: parseMaxPerm("code"),
|
||||
Issues: parseMaxPerm("issues"),
|
||||
Packages: parseMaxPerm("packages"),
|
||||
PullRequests: parseMaxPerm("pull_requests"),
|
||||
@ -130,7 +131,7 @@ func ActionsGeneralPost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("org.settings.update_setting_success"))
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings/actions")
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings/actions/general")
|
||||
}
|
||||
|
||||
// ActionsAllowedReposAdd adds a repository to the allowed list for cross-repo access
|
||||
@ -177,7 +178,7 @@ func ActionsAllowedReposAdd(ctx *context.Context) {
|
||||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings/actions")
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings/actions/general")
|
||||
}
|
||||
|
||||
// ActionsAllowedReposRemove removes a repository from the allowed list
|
||||
|
||||
@ -178,7 +178,7 @@ func UpdateTokenPermissions(ctx *context.Context) {
|
||||
}
|
||||
|
||||
actionsCfg.MaxTokenPermissions = &repo_model.ActionsTokenPermissions{
|
||||
Code: parseMaxPerm("contents"),
|
||||
Code: parseMaxPerm("code"),
|
||||
Issues: parseMaxPerm("issues"),
|
||||
Packages: parseMaxPerm("packages"),
|
||||
PullRequests: parseMaxPerm("pull_requests"),
|
||||
|
||||
@ -959,11 +959,16 @@ func registerWebRoutes(m *web.Router) {
|
||||
})
|
||||
|
||||
m.Group("/actions", func() {
|
||||
m.Get("", org_setting.ActionsGeneral)
|
||||
m.Post("", org_setting.ActionsGeneralPost)
|
||||
m.Group("/allowed_repos", func() {
|
||||
m.Post("/add", org_setting.ActionsAllowedReposAdd)
|
||||
m.Post("/remove", org_setting.ActionsAllowedReposRemove)
|
||||
m.Get("", func(ctx *context.Context) {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings/actions/general")
|
||||
})
|
||||
m.Group("/general", func() {
|
||||
m.Get("", org_setting.ActionsGeneralSettings)
|
||||
m.Post("", org_setting.UpdateTokenPermissions)
|
||||
m.Group("/allowed_repos", func() {
|
||||
m.Post("/add", org_setting.ActionsAllowedReposAdd)
|
||||
m.Post("/remove", org_setting.ActionsAllowedReposRemove)
|
||||
})
|
||||
})
|
||||
addSettingsRunnersRoutes()
|
||||
addSettingsSecretsRoutes()
|
||||
|
||||
@ -109,7 +109,7 @@ func parseRawPermissions(rawPerms *yaml.Node, defaultPerms repo_model.ActionsTok
|
||||
|
||||
// Map GitHub Actions scopes to Gitea units
|
||||
switch scope {
|
||||
case "contents":
|
||||
case "code":
|
||||
result.Code = accessMode
|
||||
case "issues":
|
||||
result.Issues = accessMode
|
||||
|
||||
@ -132,24 +132,24 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ctx.Locale.Tr "actions.general.token_permissions.contents"}}</strong>
|
||||
<p class="text small grey">{{ctx.Locale.Tr "actions.general.token_permissions.contents.description"}}</p>
|
||||
<strong>{{ctx.Locale.Tr "actions.general.token_permissions.code"}}</strong>
|
||||
<p class="text small grey">{{ctx.Locale.Tr "actions.general.token_permissions.code.description"}}</p>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_contents" value="none" {{if not ($.MaxTokenPermissions.HasRead "contents")}}checked{{end}}>
|
||||
<input type="radio" name="max_code" value="none" {{if not ($.MaxTokenPermissions.HasRead "code")}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_contents" value="read" {{if and ($.MaxTokenPermissions.HasRead "contents") (not ($.MaxTokenPermissions.HasWrite "contents"))}}checked{{end}}>
|
||||
<input type="radio" name="max_code" value="read" {{if and ($.MaxTokenPermissions.HasRead "code") (not ($.MaxTokenPermissions.HasWrite "code"))}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_contents" value="write" {{if $.MaxTokenPermissions.HasWrite "contents"}}checked{{end}}>
|
||||
<input type="radio" name="max_code" value="write" {{if $.MaxTokenPermissions.HasWrite "code"}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@ -97,26 +97,25 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Code -->
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ctx.Locale.Tr "actions.general.token_permissions.contents"}}</strong>
|
||||
<p class="text small grey">{{ctx.Locale.Tr "actions.general.token_permissions.contents.description"}}</p>
|
||||
<strong>{{ctx.Locale.Tr "actions.general.token_permissions.code"}}</strong>
|
||||
<p class="text small grey">{{ctx.Locale.Tr "actions.general.token_permissions.code.description"}}</p>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_contents" value="none" {{if not ($.MaxTokenPermissions.HasRead "contents")}}checked{{end}}>
|
||||
<input type="radio" name="max_code" value="none" {{if not ($.MaxTokenPermissions.HasRead "code")}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_contents" value="read" {{if and ($.MaxTokenPermissions.HasRead "contents") (not ($.MaxTokenPermissions.HasWrite "contents"))}}checked{{end}}>
|
||||
<input type="radio" name="max_code" value="read" {{if and ($.MaxTokenPermissions.HasRead "code") (not ($.MaxTokenPermissions.HasWrite "code"))}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_contents" value="write" {{if $.MaxTokenPermissions.HasWrite "contents"}}checked{{end}}>
|
||||
<input type="radio" name="max_code" value="write" {{if $.MaxTokenPermissions.HasWrite "code"}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user