Overview
Comment: | Fix change of id field |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA3-256: |
3bbe7a49e59e0b671a39da7b6c801590 |
User & Date: | bohwaz on 2021-04-08 16:28:56 |
Other Links: | branch diff | manifest | tags |
Context
2021-04-30
| ||
22:35 | Merge trunk changes into dev check-in: 58d38d4478 user: bohwaz tags: dev | |
2021-04-08
| ||
18:18 | 1.1.0 stable release check-in: 4c7edf1823 user: bohwaz tags: trunk, stable | |
16:28 | Fix change of id field check-in: 3bbe7a49e5 user: bohwaz tags: dev | |
16:06 | Fix migration check-in: 1a5bb28aea user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Config.php from [362169af35] to [6ac16c409f].
︙ | ︙ | |||
157 158 159 160 161 162 163 | if (!empty($values['champ_identifiant'])) { // Mettre les champs identifiant vides à NULL pour pouvoir créer un index unique $db->exec('UPDATE membres SET '.$this->get('champ_identifiant').' = NULL WHERE '.$this->get('champ_identifiant').' = "";'); | | | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | if (!empty($values['champ_identifiant'])) { // Mettre les champs identifiant vides à NULL pour pouvoir créer un index unique $db->exec('UPDATE membres SET '.$this->get('champ_identifiant').' = NULL WHERE '.$this->get('champ_identifiant').' = "";'); // Création de l'index unique / FIXME move to Champs $db->exec('DROP INDEX IF EXISTS users_id_field;'); $db->exec('CREATE UNIQUE INDEX users_id_field ON membres ('.$this->get('champ_identifiant').');'); } $db->commit(); $this->_modified = []; return true; |
︙ | ︙ | |||
242 243 244 245 246 247 248 | $champs = $this->champs_membres; $this->assert(!empty($champs->get($this->champ_identite)), sprintf('Le champ spécifié pour identité, "%s" n\'existe pas', $this->champ_identite)); $this->assert(!empty($champs->get($this->champ_identifiant)), sprintf('Le champ spécifié pour identifiant, "%s" n\'existe pas', $this->champ_identifiant)); $db = DB::getInstance(); | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | $champs = $this->champs_membres; $this->assert(!empty($champs->get($this->champ_identite)), sprintf('Le champ spécifié pour identité, "%s" n\'existe pas', $this->champ_identite)); $this->assert(!empty($champs->get($this->champ_identifiant)), sprintf('Le champ spécifié pour identifiant, "%s" n\'existe pas', $this->champ_identifiant)); $db = DB::getInstance(); $sql = sprintf('SELECT (COUNT(DISTINCT LOWER(%s)) = COUNT(*)) FROM membres WHERE %1$s IS NOT NULL AND %1$s != \'\';', $this->champ_identifiant); $is_unique = $db->firstColumn($sql); $this->assert($is_unique, sprintf('Le champ "%s" comporte des doublons et ne peut donc pas servir comme identifiant unique de connexion.', $this->champ_identifiant)); $this->assert($db->test('users_categories', 'id = ?', $this->categorie_membres), 'Catégorie de membres inconnue'); } } |
Modified src/include/lib/Garradin/Membres/Session.php from [08959104e6] to [af7b1cc2aa].
︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 | return parent::isPasswordCompromised($password); } protected function getUserForLogin($login) { $champ_id = Config::getInstance()->get('champ_identifiant'); // Ne renvoie un membre que si celui-ci a le droit de se connecter $query = 'SELECT m.id, m.%1$s AS login, m.passe AS password, m.secret_otp AS otp_secret FROM membres AS m INNER JOIN users_categories AS c ON c.id = m.id_category | > | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | return parent::isPasswordCompromised($password); } protected function getUserForLogin($login) { $champ_id = Config::getInstance()->get('champ_identifiant'); $login = strtolower($login); // Ne renvoie un membre que si celui-ci a le droit de se connecter $query = 'SELECT m.id, m.%1$s AS login, m.passe AS password, m.secret_otp AS otp_secret FROM membres AS m INNER JOIN users_categories AS c ON c.id = m.id_category WHERE m.%1$s = ? AND c.perm_connect >= %2$d LIMIT 1;'; $query = sprintf($query, $champ_id, self::ACCESS_READ); return $this->db->first($query, $login); } |
︙ | ︙ |