From: Rob van der Linde Date: Tue, 7 Nov 2023 05:44:20 +0000 (+1300) Subject: netcmd: model: User model str method returns username not cn X-Git-Tag: talloc-2.4.2~753 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=30992e865c5abe61147ca7f4288ff9f13bd4dc11;p=thirdparty%2Fsamba.git netcmd: model: User model str method returns username not cn If the cn is needed then user.cn can be used, this makes it nicer if using {user} in format strings. Signed-off-by: Rob van der Linde Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/domain/models/user.py b/python/samba/netcmd/domain/models/user.py index c18ffc6bf6d..79e30453532 100644 --- a/python/samba/netcmd/domain/models/user.py +++ b/python/samba/netcmd/domain/models/user.py @@ -33,6 +33,10 @@ class User(Model): assigned_policy = DnField("msDS-AssignedAuthNPolicy") assigned_silo = DnField("msDS-AssignedAuthNPolicySilo") + def __str__(self): + """Return username rather than cn for User model.""" + return self.username + @staticmethod def get_base_dn(ldb): """Return the base DN for the User model.