From d68b131e0f36151c70b3cc78e7da4e7c5735af81 Mon Sep 17 00:00:00 2001 From: Anuj Borah Date: Feb 11 2019 06:49:36 +0000 Subject: Issue:50211 - Making an actual Anonymous type in lib389/idm/account.py Making an actual Anonymous type in lib389/idm/account.py https://pagure.io/389-ds-base/issue/50211 Reviewed by: William Brown --- diff --git a/src/lib389/lib389/idm/account.py b/src/lib389/lib389/idm/account.py index a709473..5dd325b 100644 --- a/src/lib389/lib389/idm/account.py +++ b/src/lib389/lib389/idm/account.py @@ -181,3 +181,21 @@ class Accounts(DSLdapObjects): _gen_filter(_term_gen('objectclass'), self._objectclasses) ) + +class Anonymous(DSLdapObject): + """A single instance of Anonymous bind + + :param instance: An instance + :type instance: lib389.DirSrv + """ + def __init__(self, instance): + super(Anonymous, self).__init__(instance, dn=None) + + def bind(self, *args, **kwargs): + """Open a new connection and Anonymous bind . + You can pass arguments that will be passed to openConnection. + :returns: Connection with a binding as the Anonymous + """ + inst_clone = self._instance.clone({SER_ROOT_DN: '', SER_ROOT_PW: ''}) + inst_clone.open(*args, **kwargs) + return inst_clone