Browse Source
			
			
			Revert "refactor: add migration for email setting"
			
				This reverts commit e7859f0dac.
Signed-off-by: provokateurin <kate@provokateurin.de>
			
			
				pull/51986/head
			
			
		 
		
			
				
					
						 provokateurin
					
					7 months ago
						provokateurin
					
					7 months ago
					
				 
				
			 
		 
		
			
				
				  
				  Failed to extract signature
				  
				
			
		
		
		
	
		
			
				 5 changed files with 
5 additions and 
38 deletions
			 
			
		 
		
			
				- 
					
					
					 
					apps/provisioning_api/lib/Controller/UsersController.php
				
- 
					
					
					 
					core/Migrations/Version32000Date20250402182800.php
				
- 
					
					
					 
					lib/composer/composer/autoload_classmap.php
				
- 
					
					
					 
					lib/composer/composer/autoload_static.php
				
- 
					
					
					 
					lib/private/User/User.php
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -753,7 +753,7 @@ class UsersController extends AUserData { | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		// Fallback to display name value to avoid changing behavior with the new option.
 | 
			
		
	
		
			
				
					|  |  |  | 		if ($this->config->getSystemValue('allow_user_to_change_email', true)) { | 
			
		
	
		
			
				
					|  |  |  | 		if ($this->config->getSystemValue('allow_user_to_change_email', $allowDisplayNameChange)) { | 
			
		
	
		
			
				
					|  |  |  | 			$permittedFields[] = IAccountManager::PROPERTY_EMAIL; | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -913,7 +913,8 @@ class UsersController extends AUserData { | 
			
		
	
		
			
				
					|  |  |  | 				$permittedFields[] = IAccountManager::PROPERTY_DISPLAYNAME; | 
			
		
	
		
			
				
					|  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 			if ($this->config->getSystemValue('allow_user_to_change_email', true)) { | 
			
		
	
		
			
				
					|  |  |  | 			// Fallback to display name value to avoid changing behavior with the new option.
 | 
			
		
	
		
			
				
					|  |  |  | 			if ($this->config->getSystemValue('allow_user_to_change_email', $allowDisplayNameChange)) { | 
			
		
	
		
			
				
					|  |  |  | 				$permittedFields[] = IAccountManager::PROPERTY_EMAIL; | 
			
		
	
		
			
				
					|  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -1,33 +0,0 @@ | 
			
		
	
		
			
				
					|  |  |  | <?php | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | 
			
		
	
		
			
				
					|  |  |  |  * SPDX-License-Identifier: AGPL-3.0-or-later | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | namespace OC\Core\Migrations; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | use OCP\IConfig; | 
			
		
	
		
			
				
					|  |  |  | use OCP\Migration\IOutput; | 
			
		
	
		
			
				
					|  |  |  | use OCP\Migration\SimpleMigrationStep; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * Add `allow_user_to_change_email` system config | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | class Version32000Date20250402182800 extends SimpleMigrationStep { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	public function __construct( | 
			
		
	
		
			
				
					|  |  |  | 		private IConfig $config, | 
			
		
	
		
			
				
					|  |  |  | 	) { | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { | 
			
		
	
		
			
				
					|  |  |  | 		$allowDisplayName = $this->config->getSystemValue('allow_user_to_change_display_name', null); | 
			
		
	
		
			
				
					|  |  |  | 		$allowEmail = $this->config->getSystemValue('allow_user_to_change_email', null); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		// if displayname was set, but not the email setting, then set the email setting to the same as the email setting
 | 
			
		
	
		
			
				
					|  |  |  | 		if ($allowDisplayName !== null && $allowEmail === null) { | 
			
		
	
		
			
				
					|  |  |  | 			$this->config->setSystemValue('allow_user_to_change_email', $allowDisplayName === true); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -1377,7 +1377,6 @@ return array( | 
			
		
	
		
			
				
					|  |  |  |     'OC\\Core\\Migrations\\Version30000Date20240814180800' => $baseDir . '/core/Migrations/Version30000Date20240814180800.php', | 
			
		
	
		
			
				
					|  |  |  |     'OC\\Core\\Migrations\\Version30000Date20240815080800' => $baseDir . '/core/Migrations/Version30000Date20240815080800.php', | 
			
		
	
		
			
				
					|  |  |  |     'OC\\Core\\Migrations\\Version30000Date20240906095113' => $baseDir . '/core/Migrations/Version30000Date20240906095113.php', | 
			
		
	
		
			
				
					|  |  |  |     'OC\\Core\\Migrations\\Version32000Date20250402182800' => $baseDir . '/core/Migrations/Version32000Date20250402182800.php', | 
			
		
	
		
			
				
					|  |  |  |     'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php', | 
			
		
	
		
			
				
					|  |  |  |     'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php', | 
			
		
	
		
			
				
					|  |  |  |     'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php', | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -1410,7 +1410,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 | 
			
		
	
		
			
				
					|  |  |  |         'OC\\Core\\Migrations\\Version30000Date20240814180800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240814180800.php', | 
			
		
	
		
			
				
					|  |  |  |         'OC\\Core\\Migrations\\Version30000Date20240815080800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240815080800.php', | 
			
		
	
		
			
				
					|  |  |  |         'OC\\Core\\Migrations\\Version30000Date20240906095113' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240906095113.php', | 
			
		
	
		
			
				
					|  |  |  |         'OC\\Core\\Migrations\\Version32000Date20250402182800' => __DIR__ . '/../../..' . '/core/Migrations/Version32000Date20250402182800.php', | 
			
		
	
		
			
				
					|  |  |  |         'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php', | 
			
		
	
		
			
				
					|  |  |  |         'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php', | 
			
		
	
		
			
				
					|  |  |  |         'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php', | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -429,7 +429,8 @@ class User implements IUser { | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	public function canChangeEmail(): bool { | 
			
		
	
		
			
				
					|  |  |  | 		return $this->config->getSystemValueBool('allow_user_to_change_email', true); | 
			
		
	
		
			
				
					|  |  |  | 		// Fallback to display name value to avoid changing behavior with the new option.
 | 
			
		
	
		
			
				
					|  |  |  | 		return $this->config->getSystemValueBool('allow_user_to_change_email', $this->config->getSystemValueBool('allow_user_to_change_display_name', true)); | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	/** | 
			
		
	
	
		
			
				
					|  |  | 
 |