本文整理汇总了Python中ldapcherry.backend.backendLdap.Backend.del_user方法的典型用法代码示例。如果您正苦于以下问题:Python Backend.del_user方法的具体用法?Python Backend.del_user怎么用?Python Backend.del_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ldapcherry.backend.backendLdap.Backend
的用法示例。
在下文中一共展示了Backend.del_user方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testDelUserDontExists
# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import del_user [as 别名]
def testDelUserDontExists(self):
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
try:
inv.del_user(u'test☭')
inv.del_user(u'test☭')
except UserDoesntExist:
return
else:
raise AssertionError("expected an exception")
示例2: testModifyUser
# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import del_user [as 别名]
def testModifyUser(self):
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
user = {
'uid': u'test☭',
'sn': u'test☭',
'cn': u'test☭',
'userPassword': u'test☭',
'uidNumber': '42',
'gidNumber': '42',
'homeDirectory': '/home/test/'
}
inv.add_user(user)
inv.set_attrs(u'test☭', {'gecos': 'test2', 'homeDirectory': '/home/test/'})
inv.del_user(u'test☭')
示例3: testAddUserMissingMustattribute
# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import del_user [as 别名]
def testAddUserMissingMustattribute(self):
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
user = {
'uid': u'test☭',
'sn': u'test☭',
'cn': u'test☭',
'userPassword': u'test☭',
'gidNumber': '42',
'homeDirectory': '/home/test/'
}
try:
inv.add_user(user)
except ldap.OBJECT_CLASS_VIOLATION:
return
else:
inv.del_user(u'test☭')
raise AssertionError("expected an exception")
示例4: testAddUser
# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import del_user [as 别名]
def testAddUser(self):
try:
inv.del_user(u'test☭,cn=')
except:
pass
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
user = {
'uid': u'test☭,cn=',
'sn': u'test☭',
'cn': u'test☭',
'userPassword': u'test☭',
'uidNumber': '42',
'gidNumber': '42',
'homeDirectory': '/home/test/'
}
inv.add_user(user)
inv.del_user(u'test☭,cn=')
示例5: testAddUserDuplicate
# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import del_user [as 别名]
def testAddUserDuplicate(self):
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
user = {
'uid': u'test☭',
'sn': u'test☭',
'cn': u'test☭',
'uidNumber': '42',
'userPassword': u'test☭',
'gidNumber': '42',
'homeDirectory': '/home/test/'
}
try:
inv.add_user(user)
inv.add_user(user)
except UserAlreadyExists:
inv.del_user(u'test☭')
return
else:
inv.del_user(u'test☭')
raise AssertionError("expected an exception")
示例6: Backend
# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import del_user [as 别名]
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
print inv.get_user('jwatson')
print inv.get_groups('jwatson')
print inv.search('smit')
user = {
'uid': 'test',
'sn': 'test',
'cn': 'test',
'userPassword': 'test',
'uidNumber': '42',
'gidNumber': '42',
'homeDirectory': '/home/test/'
}
inv.add_user(user)
print inv.get_user('test')
print inv.get_groups('test')
inv.del_user('test')
groups = [
'cn=hrpeople,ou=Groups,dc=example,dc=org',
'cn=itpeople,ou=Groups,dc=example,dc=org',
]
inv.add_to_groups('jwatson', groups)
ret = inv.get_groups('jwatson')
print ret
inv.del_from_groups('jwatson', ['cn=hrpeople,ou=Groups,dc=example,dc=org'])
inv.del_from_groups('jwatson', ['cn=hrpeople,ou=Groups,dc=example,dc=org'])
print inv.group_attrs