diff --git a/routers/web/org/setting/actions.go b/routers/web/org/setting/actions.go index fba4e2905c..e06a06b390 100644 --- a/routers/web/org/setting/actions.go +++ b/routers/web/org/setting/actions.go @@ -21,7 +21,7 @@ const ( func ActionsGeneral(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("actions.actions") ctx.Data["PageIsOrgSettings"] = true - ctx.Data["PageIsOrgSettingsActions"] = true + ctx.Data["PageIsOrgSettingsActionsGeneral"] = true // Load Org Actions Config actionsCfg, err := actions_model.GetOrgActionsConfig(ctx, ctx.Org.Organization.AsUser().ID) @@ -85,15 +85,17 @@ func ActionsGeneralPost(ctx *context.Context) { actionsCfg.DefaultTokenPermissions = nil } - // Update Maximum Permissions + // Update Maximum Permissions (radio buttons: none/read/write) parseMaxPerm := func(name string) perm.AccessMode { - if ctx.FormBool("max_" + name + "_write") { + value := ctx.FormString("max_" + name) + switch value { + case "write": return perm.AccessModeWrite - } - if ctx.FormBool("max_" + name + "_read") { + case "read": return perm.AccessModeRead + default: + return perm.AccessModeNone } - return perm.AccessModeNone } actionsCfg.MaxTokenPermissions = &repo_model.ActionsTokenPermissions{ diff --git a/routers/web/repo/setting/actions.go b/routers/web/repo/setting/actions.go index 673af0a0bd..a4f0c9488e 100644 --- a/routers/web/repo/setting/actions.go +++ b/routers/web/repo/setting/actions.go @@ -178,15 +178,17 @@ func UpdateTokenPermissions(ctx *context.Context) { actionsCfg.DefaultTokenPermissions = nil } - // Update Maximum Permissions + // Update Maximum Permissions (radio buttons: none/read/write) parseMaxPerm := func(name string) perm.AccessMode { - if ctx.FormBool("max_" + name + "_write") { + value := ctx.FormString("max_" + name) + switch value { + case "write": return perm.AccessModeWrite - } - if ctx.FormBool("max_" + name + "_read") { + case "read": return perm.AccessModeRead + default: + return perm.AccessModeNone } - return perm.AccessModeNone } actionsCfg.MaxTokenPermissions = &repo_model.ActionsTokenPermissions{ diff --git a/templates/org/settings/actions_general.tmpl b/templates/org/settings/actions_general.tmpl index e56925bcff..ccd42d3361 100644 --- a/templates/org/settings/actions_general.tmpl +++ b/templates/org/settings/actions_general.tmpl @@ -1,234 +1,199 @@ {{template "org/settings/layout_head" .}}
{{ctx.Locale.Tr "general.token_permissions.cross_repo_desc"}}
{{ctx.Locale.Tr "general.token_permissions.maximum.description"}}
-{{ctx.Locale.Tr "general.token_permissions.maximum.description"}}
+ +| {{ctx.Locale.Tr "units.unit"}} | +{{ctx.Locale.Tr "general.token_permissions.access_none"}} ? | +{{ctx.Locale.Tr "general.token_permissions.access_read"}} ? | +{{ctx.Locale.Tr "general.token_permissions.access_write"}} ? | +
|---|---|---|---|
|
+ {{ctx.Locale.Tr "general.token_permissions.contents"}}
+ Access source code, files, commits and branches. + |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
|
+ {{ctx.Locale.Tr "general.token_permissions.issues"}}
+ Organize bug reports, tasks and milestones. + |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
|
+ {{ctx.Locale.Tr "general.token_permissions.pull_requests"}}
+ Enable pull requests and code reviews. + |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
|
+ {{ctx.Locale.Tr "general.token_permissions.wiki"}}
+ Write and share documentation with collaborators. + |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
|
+ {{ctx.Locale.Tr "general.token_permissions.packages"}}
+ Manage repository packages. + |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
|
+ {{ctx.Locale.Tr "general.token_permissions.actions_scope"}}
+ Manage actions. + |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+