Projet

Général

Profil

0002-data_transfer-simplify-logic-51464.patch

Valentin Deniaud, 08 décembre 2021 16:23

Télécharger (1,55 ko)

Voir les différences:

Subject: [PATCH 2/2] data_transfer: simplify logic (#51464)

 src/authentic2/data_transfer.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
src/authentic2/data_transfer.py
214 214
    def deserialize(self):
215 215
        if self._import_context.set_ou:
216 216
            ou = self._import_context.set_ou
217
            has_ou = True
218 217
        elif 'ou' in self._role_d:
219 218
            ou_d = self._role_d['ou']
220 219
            has_ou = bool(ou_d)
......
227 226
                )
228 227
        elif self._import_context.set_absent_ou_to_default:
229 228
            ou = get_default_ou()
230
            has_ou = True
231 229
        else:
232 230
            name = self._role_d.get('name') or self._role_d.get('slug') or self._role_d.get('uuid')
233 231
            raise ValidationError(_("Missing Organizational Unit for role: %s") % name)
......
235 233
        obj = search_role(self._role_d, ou=self._import_context.set_ou)
236 234

  
237 235
        kwargs = self._role_d.copy()
238
        kwargs.pop('ou', None)
236
        kwargs['ou'] = ou
239 237
        kwargs.pop('service', None)
240
        if has_ou:
241
            kwargs['ou'] = ou
242 238

  
243 239
        if 'uuid' in kwargs:
244 240
            if not isinstance(kwargs['uuid'], str):
245
-