Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
PluggableAuthService.plugins.DelegatingMultiPlugin.DelegatingMultiPlugin Class Reference
Inheritance diagram for PluggableAuthService.plugins.DelegatingMultiPlugin.DelegatingMultiPlugin:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.DelegatingMultiPlugin.DelegatingMultiPlugin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def authenticateCredentials
def updateCredentials
def resetCredentials
def getPropertiesForUser
def getRolesForPrincipal
def enumerateUsers

Public Attributes

 id
 title
 delegate

Static Public Attributes

tuple security = ClassSecurityInfo()
string meta_type = 'Delegating Multi Plugin'
tuple manage_options

Private Member Functions

def _getUserFolder

Static Private Attributes

tuple _properties

Detailed Description

The adapter that mediates between the PAS and the DelegatingUserFolder

Definition at line 82 of file DelegatingMultiPlugin.py.


Constructor & Destructor Documentation

def PluggableAuthService.plugins.DelegatingMultiPlugin.DelegatingMultiPlugin.__init__ (   self,
  id,
  title = '',
  delegate_path = '' 
)
Initialize a new instance 

Definition at line 100 of file DelegatingMultiPlugin.py.

00100 
00101     def __init__(self, id, title='', delegate_path=''):
00102         """ Initialize a new instance """
00103         self.id = id
00104         self.title = title
00105         self.delegate = delegate_path
00106 


Member Function Documentation

Safely retrieve a User Folder to work with 

Definition at line 108 of file DelegatingMultiPlugin.py.

00108 
00109     def _getUserFolder(self):
00110         """ Safely retrieve a User Folder to work with """
00111         uf = getattr(aq_base(self), 'acl_users', None)
00112 
00113         if uf is None and self.delegate:
00114             uf = self.unrestrictedTraverse(self.delegate)
00115 
00116         return uf
00117 

Here is the call graph for this function:

Here is the caller graph for this function:

Fulfill AuthenticationPlugin requirements 

Definition at line 119 of file DelegatingMultiPlugin.py.

00119 
00120     def authenticateCredentials(self, credentials):
00121         """ Fulfill AuthenticationPlugin requirements """
00122         acl = self._getUserFolder()
00123         login = credentials.get('login', '')
00124         password = credentials.get('password', '')
00125 
00126         if not acl or not login or not password:
00127             return (None, None)
00128 
00129         if login == emergency_user.getUserName() and \
00130                 AuthEncoding.pw_validate(emergency_user._getPassword(), password):
00131             return ( login, login )
00132 
00133         user = acl.getUser(login)
00134 
00135         if user is None:
00136             return (None, None)
00137 
00138         elif user and AuthEncoding.pw_validate(user._getPassword(),
00139                                                password):
00140             return ( user.getId(), login )
00141 
00142         return (None, None)
00143 

Here is the call graph for this function:

def PluggableAuthService.plugins.DelegatingMultiPlugin.DelegatingMultiPlugin.enumerateUsers (   self,
  id = None,
  login = None,
  exact_match = 0,
  sort_by = None,
  max_results = None,
  kw 
)
Fulfill the EnumerationPlugin requirements 

Definition at line 199 of file DelegatingMultiPlugin.py.

00199 
00200                       ):
00201         """ Fulfill the EnumerationPlugin requirements """
00202         result = []
00203         acl = self._getUserFolder()
00204         plugin_id = self.getId()
00205         edit_url = '%s/%s/manage_userrecords' % (plugin_id, acl.getId())
00206 
00207         if acl is None:
00208             return ()
00209 
00210         if exact_match:
00211             if id:
00212                 user = acl.getUserById(id)
00213             elif login:
00214                 user = acl.getUser(login)
00215             else:
00216                 msg = 'Exact Match specified but no ID or Login given'
00217                 raise ValueError, msg
00218 
00219             if user is not None:
00220                 result.append( { 'id' : user.getId()
00221                                , 'login' : user.getUserName()
00222                                , 'pluginid' : plugin_id
00223                                , 'editurl' : '%s' % edit_url
00224                                } ) 
00225         else:
00226             l_results = []
00227             seen = []
00228             # XXX WAAAAA!!!!
00229             all_users = acl.getUsers()
00230 
00231             for user in all_users:
00232                 if id:
00233                     if user.getId().find(id) != -1:
00234                         result.append( { 'login' : user.getUserName()
00235                                        , 'id' : user.getId()
00236                                        , 'pluginid' : plugin_id
00237                                        } )
00238                 elif login:
00239                     if user.getUserName().find(login) != -1:
00240                         result.append( { 'login' : user.getUserName()
00241                                        , 'id' : user.getId()
00242                                        , 'pluginid' : plugin_id
00243                                        } )
00244 
00245             if sort_by is not None:
00246                 result.sort(lambda a, b: cmp( a.get(sort_by, '').lower()
00247                                             , b.get(sort_by, '').lower()
00248                                             ) )
00249 
00250             if max_results is not None:
00251                 try:
00252                     max_results = int(max_results)
00253                     result = result[:max_results+1]
00254                 except ValueError:
00255                     pass
00256 
00257         return tuple(result)
00258 
00259 classImplements( DelegatingMultiPlugin
00260                , IDelegatingMultiPlugin
00261                , IAuthenticationPlugin
00262                , IUserEnumerationPlugin
00263                , IRolesPlugin
00264                , ICredentialsUpdatePlugin
00265                , ICredentialsResetPlugin
00266                , IPropertiesPlugin
00267                )
00268 
00269 
00270 InitializeClass(DelegatingMultiPlugin)

Here is the caller graph for this function:

Fullfill PropertiesPlugin requirements 

Definition at line 159 of file DelegatingMultiPlugin.py.

00159 
00160     def getPropertiesForUser(self, user, request=None):
00161         """ Fullfill PropertiesPlugin requirements """
00162         acl = self._getUserFolder()
00163 
00164         if acl is None:
00165             return {}
00166 
00167         user = acl.getUserById(user.getId())
00168 
00169         if user is None:
00170             return {}
00171 
00172         # XXX WAAA
00173         return copy.deepcopy(user.__dict__)
00174 

Here is the call graph for this function:

Fullfill RolesPlugin requirements 

Definition at line 176 of file DelegatingMultiPlugin.py.

00176 
00177     def getRolesForPrincipal(self, user, request=None):
00178         """ Fullfill RolesPlugin requirements """
00179         acl = self._getUserFolder()
00180 
00181         if acl is None:
00182             return ()
00183 
00184         user = acl.getUserById(user.getId())
00185 
00186         if user is None:
00187             return ()
00188 
00189         return tuple(user.getRoles())
00190 

Here is the call graph for this function:

Fulfill CredentialsResetPlugin requirements 

Definition at line 152 of file DelegatingMultiPlugin.py.

00152 
00153     def resetCredentials(self, request, response):
00154         """ Fulfill CredentialsResetPlugin requirements """
00155         # Remove user from cache?
00156         pass
00157 

def PluggableAuthService.plugins.DelegatingMultiPlugin.DelegatingMultiPlugin.updateCredentials (   self,
  request,
  response,
  login,
  new_password 
)
Fulfill CredentialsUpdatePlugin requirements 

Definition at line 145 of file DelegatingMultiPlugin.py.

00145 
00146     def updateCredentials(self, request, response, login, new_password):
00147         """ Fulfill CredentialsUpdatePlugin requirements """
00148         # Need to at least remove user from cache
00149         pass
00150 


Member Data Documentation

Initial value:
( { 'id' : 'delegate'
                    , 'label' : ' Delegate Path'
                    , 'type' : 'string'
                    , 'mode' : 'w'
                    }
                  ,
                  )

Definition at line 92 of file DelegatingMultiPlugin.py.

Definition at line 104 of file DelegatingMultiPlugin.py.

Definition at line 102 of file DelegatingMultiPlugin.py.

Initial value:
( BasePlugin.manage_options[:1]
                     + Folder.manage_options
                     )

Definition at line 88 of file DelegatingMultiPlugin.py.

Definition at line 86 of file DelegatingMultiPlugin.py.

Definition at line 85 of file DelegatingMultiPlugin.py.

Definition at line 103 of file DelegatingMultiPlugin.py.


The documentation for this class was generated from the following file: