1818
1919import org .apache .commons .lang3 .StringUtils ;
2020import org .jetbrains .annotations .NotNull ;
21+ import org .jetbrains .annotations .Nullable ;
2122import org .labkey .api .data .Container ;
2223import org .labkey .api .data .ContainerManager ;
2324import org .labkey .api .data .CoreSchema ;
5354import org .labkey .api .settings .AppProps ;
5455import org .labkey .api .util .ContainerUtil ;
5556import org .labkey .api .util .PageFlowUtil ;
56- import org .labkey .api .view .NotFoundException ;
5757
5858import java .sql .SQLException ;
5959import java .util .ArrayList ;
@@ -353,13 +353,12 @@ public String getAllBlogsPath(Container container)
353353 return PageFlowUtil .decode (mp .getEffectiveValue (container ));
354354 }
355355
356- public TableInfo getSiteUserTableInfo (User user )
356+ @ Nullable
357+ public Domain getSiteUserDomain (User user )
357358 {
358359 UserSchema coreSchema = QueryService .get ().getUserSchema (user , getUserTableContainer (), "core" );
359- TableInfo tableInfo = coreSchema .getTable ("SiteUsers" );
360- if (tableInfo == null )
361- throw new NotFoundException ("SiteUsers table not available. You don't have permission to the project." );
362- return tableInfo ;
360+ TableInfo userTable = coreSchema .getTable ("SiteUsers" );
361+ return userTable != null ? userTable .getDomain () : null ;
363362 }
364363
365364 private Container getUserTableContainer ()
@@ -370,7 +369,7 @@ private Container getUserTableContainer()
370369 public boolean isNeedSurvey (User user )
371370 {
372371 String needSurveyProp = "NeedSurvey" ;
373- Domain domain = getSiteUserTableInfo (user ). getDomain ( );
372+ Domain domain = getSiteUserDomain (user );
374373 if (domain == null )
375374 return false ;
376375
@@ -392,7 +391,7 @@ public boolean isNeedSurvey(User user)
392391
393392 public void setNeedSurvey (User user , boolean needSurvey ) throws ValidEmail .InvalidEmailException , SQLException , BatchValidationException , InvalidKeyException , QueryUpdateServiceException , ValidationException
394393 {
395- Domain domain = getSiteUserTableInfo (user ). getDomain ( );
394+ Domain domain = getSiteUserDomain (user );
396395 if (domain == null )
397396 return ;
398397
@@ -408,7 +407,7 @@ public void updateSurvey(User user, String firstName, String lastName, String in
408407 //TODO simplify code once "Issue 34721: UsersTable permission handling improvement" is fixed
409408 updateUserName (user , firstName , lastName );
410409
411- Domain domain = getSiteUserTableInfo (user ). getDomain ( );
410+ Domain domain = getSiteUserDomain (user );
412411 if (domain == null )
413412 return ;
414413
0 commit comments