コード例 #1
0
ファイル: get.py プロジェクト: tuxwerk/plone.restapi
 def search_for_principal(hunter, search_term):
     return merge_search_results(
         chain(*[
             hunter.searchUsers(**{field: search_term})
             for field in ["name", "fullname", "email"]
         ]),
         "userid",
     )
コード例 #2
0
ファイル: get.py プロジェクト: tuxwerk/plone.restapi
 def search_for_principal(hunter, search_term):
     return merge_search_results(
         chain(*[
             hunter.searchGroups(**{field: search_term})
             for field in ["id", "title"]
         ]),
         "groupid",
     )
コード例 #3
0
        def search_for_principal(hunter, search_term):
            group_attribute = api.portal.get_registry_record(
                name='group_title_ldap_attribute',
                interface=IOGDSSyncConfiguration)

            fields = ['id', 'title']
            if group_attribute:
                fields.append(group_attribute)

            return merge_search_results(
                chain(*[
                    hunter.searchGroups(**{field: search_term})
                    for field in fields
                ]), 'groupid')
コード例 #4
0
ファイル: members.py プロジェクト: upiq/uu.qiext
 def search(self, query, **kwargs):
     """
     Given a string or unicode object as a query, search for
     user by full name or email address / user id.  Return a
     iterator of tuples of (username, user) for each match.
     """
     q = {'name': query, 'email': query}  # either name or email
     q.update(kwargs or {})
     r = merge_search_results(
         itertools.chain(
             *[self._uf.searchUsers(**{field: query})
                 for field in ('login', 'fullname')]),
         key='userid',
         )
     # filter search results in case any PAS plugin is keeping cruft for
     # since removed users:
     r = filter(lambda info: info['login'] in self.keys(), r)
     _t = lambda username: (username, self._uf.getUser(username))
     return [_t(username) for username in [info['login'] for info in r]]
コード例 #5
0
 def search(self, query, **kwargs):
     """
     Given a string or unicode object as a query, search for
     user by full name or email address / user id.  Return a
     iterator of tuples of (username, user) for each match.
     """
     q = {'name': query, 'email': query}  # either name or email
     q.update(kwargs or {})
     search_fields = ('login', 'fullname')
     result = list(
         itertools.chain(*[
             self._uf.searchUsers(**{field: query})
             for field in search_fields
         ]))
     for info in result:
         if 'email' not in info:
             info['email'] = info['login']
     r = merge_search_results(result, key='email')
     # filter search results in case any PAS plugin is keeping cruft for
     # since removed users:
     r = filter(lambda info: info['email'] in self.keys(), r)
     _t = lambda username: (username, self._uf.getUser(username))
     return [_t(username) for username in [info['email'] for info in r]]
コード例 #6
0
 def search_for_principal(hunter, search_term):
     registry = getUtility(IRegistry)
     fields = registry["ftw.permissionmanager.fields_to_search"]
     return merge_search_results(chain(*[hunter.searchUsers(**{field: search_term})
         for field in fields]), 'userid')
コード例 #7
0
 def search_for_principal(hunter, search_term):
     return merge_search_results(
         chain(*[
             hunter.searchUsers(**{field: search_term})
             for field in ['name', 'fullname', 'email']
         ]), 'userid')
コード例 #8
0
ファイル: get.py プロジェクト: tulikavijay/plone.restapi
 def search_for_principal(hunter, search_term):
     return merge_search_results(
         chain(*[hunter.searchGroups(**{field: search_term})
               for field in ['id', 'title']]), 'groupid')