How often is settings.php called? And is $user available to it?
The settings.php file is included on the first bootstrap phase (DRUPAL_BOOTSTRAP_CONFIGURATION), while the global $user is initialized on DRUPAL_BOOTSTRAP_PAGE_CACHE or DRUPAL_BOOTSTRAP_SESSION, which are both later bootstrap phases.

The settings.php file is included each times Drupal bootstraps, which means every time Drupal serves a page, including the ones served from its cache. As such, the settings.php file can use plain PHP functions or a restrict set of Drupal functions; in both the cases, the code cannot access the user variable. It is not even possible to initialize it using the database, since the database connection is initialized after the file has been included. (The obvious reason is that the database settings are contained in the settings.php file.)

Reference


drupal_bootstrap()