/** * Class Cfg * * Handles configuration management, database connection, and user access control for the application. * * Responsibilities: * - Defines constants for user identifiers, Active Directory (AD) groups, and access levels. * - Manages valid AD groups and their corresponding access levels. * - Provides localized week day names and acronyms. * - Establishes a PDO connection to the database and retrieves configuration values. * - Handles OAuth2 configuration and environment variables. * - Determines user access levels and permissions based on AD group membership. * - Provides utility methods for session simulation and maintenance mode. * * Properties: * @property array $validADGroups Mapping of AD group names to access levels. * @property array $values Configuration values loaded from the database. * @property array $oauth2 OAuth2 configuration values. * @property \PDO|object $pdo PDO database connection or empty object on failure. * @property object $servidor Environment configuration object. * @property static array $weekDays Localized names of the days of the week. * @property static array $acronymsOfDays Acronyms for the days of the week. * * Methods: * - __construct(): Initializes environment, database connection, and loads configuration. * - getConfigValuesFromDB(): Loads configuration values from the database. * - isOauthKey(string $nameInDB): Checks if a config key is an OAuth key. * - extractOauthKey(string $nameInDB): Extracts the OAuth key name. * - oauthValues(array $row, string $key, array &$oauth): Processes OAuth-related config values. * - oauthEnv(): Returns OAuth2 environment configuration. * - value(string $name): Retrieves a configuration value. * - DSN(string $cs = 'UTF8'): Builds the DSN string for PDO. * - user(): Returns the database username. * - pswd(): Returns the database password. * - isValidADGrup(): Checks if the current user belongs to a valid AD group. * - canAccessTo(string $grup): Checks if the user can access a specific group. * - getUserLevel(): Determines the user's access level based on AD group membership. * - getLevelGrups(int $level): Retrieves accessible groups for a given access level. * - groupInAccesses(string $group, mixed $accesses): Checks if a group is in the access list. * - isADGroupInUserGroups(mixed $adGroupToSearch, mixed $userGroups): Checks if an AD group is in the user's groups. * - static fakeSession(string $oauth2TokenSessionVar): Simulates a user session for testing. * - static noWeb(string $msg): Returns a maintenance page with a custom message. */