예제 #1
0
def lookup(co,
           lo,
           filter_s,
           base='',
           superordinate=None,
           scope='sub',
           unique=0,
           required=0,
           timeout=-1,
           sizelimit=0):
    """Search for UVMM profile objects."""
    filter_expr = udm_filter.conjunction('&', [
        udm_filter.expression('objectClass',
                              'univentionVirtualMachineProfile'),
    ])

    if filter_s:
        filter_p = udm_filter.parse(filter_s)
        udm_filter.walk(filter_p,
                        univention.admin.mapping.mapRewrite,
                        arg=mapping)
        filter_expr.expressions.append(filter_p)

    return [
        object(co, lo, None, dn) for dn in lo.searchDn(unicode(
            filter_expr), base, scope, unique, required, timeout, sizelimit)
    ]
예제 #2
0
파일: umc.py 프로젝트: bopopescu/smart-1
def lookup(co,
           lo,
           filter_s,
           base='',
           superordinate=None,
           scope='sub',
           unique=0,
           required=0,
           timeout=-1,
           sizelimit=0):

    filter = udm_filter.conjunction(
        '&', [udm_filter.expression('objectClass', 'umcPolicy')])

    if filter_s:
        filter_p = udm_filter.parse(filter_s)
        udm_filter.walk(filter_p, udm_mapping.mapRewrite, arg=mapping)
        filter.expressions.append(filter_p)

    res = []
    try:
        for dn, attrs in lo.search(unicode(filter), base, scope, [], unique,
                                   required, timeout, sizelimit):
            res.append(object(co, lo, None, dn, attributes=attrs))
    except:
        pass
    return res
예제 #3
0
파일: user.py 프로젝트: spaceone/ucs-school
 def lookup(cls, lo, school, filter_s='', superordinate=None):
     filter_object_type = conjunction('&', [
         parse(cls.type_filter),
         parse(filter_format('ucsschoolSchool=%s', [school]))
     ])
     if filter_s:
         filter_object_type = conjunction(
             '&', [filter_object_type, parse(filter_s)])
     objects = udm_modules.lookup(cls._meta.udm_module,
                                  None,
                                  lo,
                                  filter=unicode(filter_object_type),
                                  scope='sub',
                                  superordinate=superordinate)
     objects.extend(obj for obj in super(User, cls).lookup(
         lo, school, filter_s, superordinate=superordinate)
                    if not any(obj.dn == x.dn for x in objects))
     return objects
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=False, required=False, timeout=-1, sizelimit=0):

	filter = udm_filter.conjunction('&', [
		udm_filter.expression('objectClass', 'umcOperationSet')
	])

	if filter_s:
		filter_p = udm_filter.parse(filter_s)
		udm_filter.walk(filter_p, udm_mapping.mapRewrite, arg=mapping)
		filter.expressions.append(filter_p)

	return object.lookup(co, lo, filter, base, superordinate, scope, unique, required, timeout, sizelimit)
예제 #5
0
파일: profile.py 프로젝트: B-Rich/smart
def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
	"""Search for UVMM profile objects."""
	filter_expr = udm_filter.conjunction('&', [
		udm_filter.expression('objectClass', 'univentionVirtualMachineProfile'),
		])

	if filter_s:
		filter_p = udm_filter.parse(filter_s)
		udm_filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping)
		filter_expr.expressions.append(filter_p)

	return [object(co, lo, None, dn)
			for dn in lo.searchDn(unicode(filter_expr), base, scope, unique, required, timeout, sizelimit)]
예제 #6
0
def lookup( co, lo, filter_s, base = '', superordinate = None, scope = 'sub', unique = 0, required = 0, timeout = -1, sizelimit = 0 ):

	filter=udm_filter.conjunction('&', [
		udm_filter.expression('objectClass', 'umcOperationSet')
		])

	if filter_s:
		filter_p=udm_filter.parse(filter_s)
		udm_filter.walk( filter_p, udm_mapping.mapRewrite, arg=mapping)
		filter.expressions.append(filter_p)

	res=[]
	try:
		for dn in lo.searchDn(unicode(filter), base, scope, unique, required, timeout, sizelimit):
			res.append(object(co, lo, None, dn))
	except:
		pass
	return res