@@ -115,8 +115,8 @@ protected function testValueLengths(array $properties, bool $throwOnData = false
115115 }
116116 }
117117
118- protected function testPropertyScope (IAccountProperty $ property , array $ allowedScopes, bool $ throwOnData ): void {
119- if ($ throwOnData && !in_array ($ property ->getScope (), $ allowedScopes , true )) {
118+ protected function testPropertyScope (IAccountProperty $ property , array $ allowedScopes ): void {
119+ if (!in_array ($ property ->getScope (), $ allowedScopes , true )) {
120120 throw new InvalidArgumentException ('scope ' );
121121 }
122122
@@ -125,36 +125,23 @@ protected function testPropertyScope(IAccountProperty $property, array $allowedS
125125 in_array ($ property ->getName (), self ::UNPUBLISHED_PROPERTIES , true )
126126 && in_array ($ property ->getScope (), [self ::SCOPE_FEDERATED , self ::SCOPE_PUBLISHED ], true )
127127 ) {
128- if ($ throwOnData ) {
129- throw new InvalidArgumentException ('scope ' );
130- } else {
131- $ property ->setScope (self ::SCOPE_LOCAL );
132- }
128+ throw new InvalidArgumentException ('scope ' );
133129 }
134130
135131 // PUBLISHED scope requires the lookup server upload to be enabled by the admin.
136132 if ($ property ->getScope () === self ::SCOPE_PUBLISHED ) {
137133 $ lookupServerUploadEnabled = $ this ->config ->getAppValue ('files_sharing ' , 'lookupServerUploadEnabled ' , 'no ' ) === 'yes ' ;
138134 if (!$ lookupServerUploadEnabled ) {
139- if ($ throwOnData ) {
140- throw new InvalidArgumentException ('scope ' );
141- } else {
142- $ property ->setScope (self ::SCOPE_LOCAL );
143- }
135+ throw new InvalidArgumentException ('scope ' );
144136 }
145137 }
146138
147139 if (
148140 $ property ->getScope () === self ::SCOPE_PRIVATE
149141 && in_array ($ property ->getName (), [self ::PROPERTY_DISPLAYNAME , self ::PROPERTY_EMAIL ])
150142 ) {
151- if ($ throwOnData ) {
152- // v2-private is not available for these fields
153- throw new InvalidArgumentException ('scope ' );
154- } else {
155- // default to local
156- $ property ->setScope (self ::SCOPE_LOCAL );
157- }
143+ // v2-private is not available for these fields
144+ throw new InvalidArgumentException ('scope ' );
158145 } else {
159146 // migrate scope values to the new format
160147 // invalid scopes are mapped to a default value
@@ -901,7 +888,7 @@ public function updateAccount(IAccount $account): void {
901888 }
902889
903890 foreach ($ account ->getAllProperties () as $ property ) {
904- $ this ->testPropertyScope ($ property , self ::ALLOWED_SCOPES , true );
891+ $ this ->testPropertyScope ($ property , self ::ALLOWED_SCOPES );
905892 }
906893
907894 $ oldData = $ this ->getUser ($ account ->getUser (), false );
0 commit comments