本文整理汇总了Python中mmc.support.mmctools.SecurityContext.userdn方法的典型用法代码示例。如果您正苦于以下问题:Python SecurityContext.userdn方法的具体用法?Python SecurityContext.userdn怎么用?Python SecurityContext.userdn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mmc.support.mmctools.SecurityContext
的用法示例。
在下文中一共展示了SecurityContext.userdn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: purge_removed_computers
# 需要导入模块: from mmc.support.mmctools import SecurityContext [as 别名]
# 或者: from mmc.support.mmctools.SecurityContext import userdn [as 别名]
def purge_removed_computers():
from mmc.plugins.base.computers import ComputerManager
from mmc.plugins.base import LdapUserGroupControl
# Get all imaging targets
targets = ImagingDatabase().getAllRegisteredComputers()
# Creating root context to query ComputerManager
ctx = SecurityContext()
ctx.userid = 'root'
ctx.userdn = LdapUserGroupControl().searchUserDN(ctx.userid)
# Init to_delete computer list
to_delete = []
for uuid in targets:
if ComputerManager().getComputerCount(ctx, {'uuid': uuid}) == 0:
# If the target computer is not in ComputerManager database anymore
# we unregister it from imaging
to_delete.append(uuid)
# Unregistering orphan targets without backup
if to_delete:
logging.getLogger().info('Orphan imaging computer(s) found')
logging.getLogger().info('Going to purge %s' % ' '.join(to_delete))
computersUnregister(to_delete, False)
return True
示例2: getContext
# 需要导入模块: from mmc.support.mmctools import SecurityContext [as 别名]
# 或者: from mmc.support.mmctools.SecurityContext import userdn [as 别名]
def getContext(self, user='root'):
s = SecurityContext()
s.userid = user
s.userdn = LdapUserGroupControl().searchUserDN(s.userid)
return s
示例3: getContext
# 需要导入模块: from mmc.support.mmctools import SecurityContext [as 别名]
# 或者: from mmc.support.mmctools.SecurityContext import userdn [as 别名]
def getContext(self):
s = SecurityContext()
s.userid = self.userid
s.userdn = LdapUserGroupControl().searchUserDN(self.userid)
return s