Commit 33f66045 authored by Łukasz Nowak's avatar Łukasz Nowak

- implement IUserEnumerationPlugin


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43291 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7814d755
...@@ -293,6 +293,46 @@ class VifibMachineAuthenticationPlugin(BasePlugin): ...@@ -293,6 +293,46 @@ class VifibMachineAuthenticationPlugin(BasePlugin):
user_name=principal.getId(), user_name=principal.getId(),
path=self.getPhysicalPath()) path=self.getPhysicalPath())
#
# IUserEnumerationPlugin implementation
#
security.declarePrivate( 'enumerateUsers' )
def enumerateUsers(self, id=None, login=None, exact_match=False,
sort_by=None, max_results=None, **kw):
""" See IUserEnumerationPlugin.
"""
if id is None:
id = login
if isinstance(id, str):
id = (id,)
if isinstance(id, list):
id = tuple(id)
user_info = []
plugin_id = self.getId()
id_list = []
for user_id in id:
if SUPER_USER == user_id:
info = { 'id' : SUPER_USER
, 'login' : SUPER_USER
, 'pluginid' : plugin_id
}
user_info.append(info)
else:
id_list.append(user_id)
if id_list:
for user in self.getUserByLogin(tuple(id_list)):
info = { 'id' : user.getReference()
, 'login' : user.getReference()
, 'pluginid' : plugin_id
}
user_info.append(info)
return tuple(user_info)
#List implementation of class #List implementation of class
classImplements(VifibMachineAuthenticationPlugin, classImplements(VifibMachineAuthenticationPlugin,
plugins.IAuthenticationPlugin) plugins.IAuthenticationPlugin)
...@@ -302,6 +342,9 @@ classImplements( VifibMachineAuthenticationPlugin, ...@@ -302,6 +342,9 @@ classImplements( VifibMachineAuthenticationPlugin,
classImplements( VifibMachineAuthenticationPlugin, classImplements( VifibMachineAuthenticationPlugin,
plugins.IGroupsPlugin plugins.IGroupsPlugin
) )
classImplements( VifibMachineAuthenticationPlugin,
plugins.IUserEnumerationPlugin
)
InitializeClass(VifibMachineAuthenticationPlugin) InitializeClass(VifibMachineAuthenticationPlugin)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment