mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 01:34:27 +00:00 
			
		
		
		
	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.  2. `actions` is not displayed in the sidebar on the team details page 
This commit is contained in:
		@@ -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" {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user