aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorsillyguodong <33891828+sillyguodong@users.noreply.github.com>2023-05-05 20:02:30 +0800
committerGitHub <noreply@github.com>2023-05-05 20:02:30 +0800
commita866cb0cb92a2308a83bae549e3832fcf2c4548b (patch)
tree1b8ac3354f2c0195a3193768781c75ff05f985f2 /modules
parenta1cd455c85678570e0f1b56065b1c1b9781eca7c (diff)
downloadgitea-a866cb0cb92a2308a83bae549e3832fcf2c4548b.tar.gz
gitea-a866cb0cb92a2308a83bae549e3832fcf2c4548b.zip
Fix the permission of team's `Actions` unit issue (#24536)
close #24449 The unit of `Actions` should be contorlled not only by `repository.DISABLED_REPO_UNITS` but also by `actions.ENABLED` in the `app.ini`. Previously, the permission of the team's `Actions` unit was not controlled by `actions.Enabled`. So, even if the user sets `actions.Enabled` to false, he can still select the permission of the `Actions` unit for the team. This PR makes the permissions of the team's `Actions` unit also controlled by `actions.Enabled`. Just append`TypeActions` into `DisabledRepoUnits` slice when initializing if `actions.Enabled` is false. ### Changes: If `Actions` is set disbaled in `app.ini`, like below: ```yaml [actions] ENABLED = false ``` 1. If user try to create/edit a team, will prompt user that `Actions` is disabled. ![image](https://user-images.githubusercontent.com/33891828/236370415-961082b2-82d2-4d9e-8025-83872ad08cbb.png) 2. `actions` is not displayed in the sidebar on the team details page ![image](https://user-images.githubusercontent.com/33891828/236371817-f39f9bc9-5926-4b88-b5e6-d93617fcfb07.png)
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/repository.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/setting/repository.go b/modules/setting/repository.go
index 20ed6d0dcd..56e7e6f4ac 100644
--- a/modules/setting/repository.go
+++ b/modules/setting/repository.go
@@ -308,6 +308,10 @@ func loadRepositoryFrom(rootCfg ConfigProvider) {
Repository.DisabledRepoUnits = append(Repository.DisabledRepoUnits, "repo.packages")
}
+ if !rootCfg.Section("actions").Key("ENABLED").MustBool(true) {
+ Repository.DisabledRepoUnits = append(Repository.DisabledRepoUnits, "repo.actions")
+ }
+
// Handle default trustmodel settings
Repository.Signing.DefaultTrustModel = strings.ToLower(strings.TrimSpace(Repository.Signing.DefaultTrustModel))
if Repository.Signing.DefaultTrustModel == "default" {