コード例 #1
0
	def get_all_ous(self):
		try:
			for ou in self.ldap.get_all_ous():
				self.agent_out_q.put((LDAPAgentCommand.OU, JackDawADOU.from_adou(ou)))
		except Exception as e:
			self.agent_out_q.put((LDAPAgentCommand.EXCEPTION, str(traceback.format_exc())))
		finally:
			self.agent_out_q.put((LDAPAgentCommand.OUS_FINISHED, None))
コード例 #2
0
	async def get_all_ous(self):
		try:
			async for ou in self.ldap.get_all_ous():
				o = JackDawADOU.from_adou(ou)
				await self.agent_out_q.coro_put((LDAPAgentCommand.OU, o))
				del o
		except:
			await self.agent_out_q.coro_put((LDAPAgentCommand.EXCEPTION, str(traceback.format_exc())))
		finally:
			await self.agent_out_q.coro_put((LDAPAgentCommand.OUS_FINISHED, None))
コード例 #3
0
    def import_ous(self):
        print('Importing ous!')
        for ou in self.get_file('ous')['ous']:
            #pprint.pprint(groups)
            #input()
            try:
                ad_name = ou['Name'].rsplit('@', 1)[1]
                m = JackDawADOU()
                m.ad_id = self.adn[ad_name]
                m.name = ou['Name'].split('@', 1)[0]
                m.objectSid = ou['Properties']['objectsid']
                m.description = ou['Properties'].get('description', None)

                self.db_session.add(m)
            except Exception as e:
                print(e)
                pprint.pprint(ou)
                input()
                continue
        self.db_session.commit()
コード例 #4
0
ファイル: ldap.py プロジェクト: yarbs/jackdaw
	def get_all_ous(self):
		for ou in self.ldap.get_all_ous():
			yield (ou, JackDawADOU.from_adou(ou))