Back to index

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

List of all members.

Public Member Functions

def manage_editIDPattern
def getIDPattern
def getDefaultIDPattern
def isRegistrationAllowed
def testPasswordValidity
def testPropertiesValidity
def generatePassword
def addMember
def isMemberIdAllowed
def afterAdd
def mailPassword

Public Attributes

 member_id_pattern

Static Public Attributes

string id = 'portal_registration'
string meta_type = 'CMF Registration Tool'
string member_id_pattern = ''
string default_member_id_pattern = "^[A-Za-z][A-Za-z0-9_]*$"
tuple security = ClassSecurityInfo()
tuple manage_options
tuple manage_overview = DTMLFile( 'explainRegistrationTool', _dtmldir )
tuple manage_configuration = DTMLFile('configureRegistrationTool', _dtmldir)

Private Attributes

 _ALLOWED_MEMBER_ID_PATTERN

Static Private Attributes

tuple __implements__ = (z2IRegistrationTool, )
tuple _ALLOWED_MEMBER_ID_PATTERN = re.compile(default_member_id_pattern)

Detailed Description

Create and modify users by making calls to portal_membership.

Definition at line 42 of file RegistrationTool.py.


Member Function Documentation

def CMFCore.RegistrationTool.RegistrationTool.addMember (   self,
  id,
  password,
  roles = ('Member',,
  domains = '',
  properties = None,
  REQUEST = None 
)
Creates a PortalMember and returns it. The properties argument
can be a mapping with additional member properties. Raises an
exception if the given id already exists, the password does not
comply with the policy in effect, or the authenticated user is not
allowed to grant one of the roles listed (where Member is a special
role that can always be granted); these conditions should be
detected before the fact so that a cleaner message can be printed.

Definition at line 137 of file RegistrationTool.py.

00137 
00138                   properties=None, REQUEST=None):
00139         '''Creates a PortalMember and returns it. The properties argument
00140         can be a mapping with additional member properties. Raises an
00141         exception if the given id already exists, the password does not
00142         comply with the policy in effect, or the authenticated user is not
00143         allowed to grant one of the roles listed (where Member is a special
00144         role that can always be granted); these conditions should be
00145         detected before the fact so that a cleaner message can be printed.
00146         '''
00147         # XXX: this method violates the rules for tools/utilities:
00148         # it depends on a non-utility tool
00149         if not self.isMemberIdAllowed(id):
00150             raise ValueError(_(u'The login name you selected is already in '
00151                                u'use or is not valid. Please choose another.'))
00152 
00153         failMessage = self.testPasswordValidity(password)
00154         if failMessage is not None:
00155             raise ValueError(failMessage)
00156 
00157         if properties is not None:
00158             failMessage = self.testPropertiesValidity(properties)
00159             if failMessage is not None:
00160                 raise ValueError(failMessage)
00161 
00162         # Limit the granted roles.
00163         # Anyone is always allowed to grant the 'Member' role.
00164         _limitGrantedRoles(roles, self, ('Member',))
00165 
00166         membership = getToolByName(self, 'portal_membership')
00167         membership.addMember(id, password, roles, domains, properties)
00168 
00169         member = membership.getMemberById(id)
00170         self.afterAdd(member, id, password, properties)
00171         return member

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.RegistrationTool.RegistrationTool.afterAdd (   self,
  member,
  id,
  password,
  properties 
)
Called by portal_registration.addMember()
after a member has been added successfully.

Definition at line 188 of file RegistrationTool.py.

00188 
00189     def afterAdd(self, member, id, password, properties):
00190         '''Called by portal_registration.addMember()
00191         after a member has been added successfully.'''
00192         pass

Here is the caller graph for this function:

Generate a valid password.

Definition at line 127 of file RegistrationTool.py.

00127 
00128     def generatePassword(self):
00129         """ Generate a valid password.
00130         """
00131         # we don't use these to avoid typos: OQ0Il1
00132         chars = 'ABCDEFGHJKLMNPRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789'
00133         return ''.join( [ choice(chars) for i in range(6) ] )

Here is the call graph for this function:

Return the currently-used member ID pattern 

Definition at line 97 of file RegistrationTool.py.

00097 
00098     def getDefaultIDPattern(self):
00099         """ Return the currently-used member ID pattern """
00100         return self.default_member_id_pattern
00101 

Return the currently-used member ID pattern 

Definition at line 92 of file RegistrationTool.py.

00092 
00093     def getIDPattern(self):
00094         """ Return the currently-used member ID pattern """
00095         return self.member_id_pattern

Returns 1 if the ID is not in use and is not reserved.

Definition at line 173 of file RegistrationTool.py.

00173 
00174     def isMemberIdAllowed(self, id):
00175         '''Returns 1 if the ID is not in use and is not reserved.
00176         '''
00177         # XXX: this method violates the rules for tools/utilities:
00178         # it depends on a non-utility tool
00179         if len(id) < 1 or id == 'Anonymous User':
00180             return 0
00181         if not self._ALLOWED_MEMBER_ID_PATTERN.match( id ):
00182             return 0
00183         membership = getToolByName(self, 'portal_membership')
00184         if membership.getMemberById(id) is not None:
00185             return 0
00186         return 1

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a boolean value indicating whether the user
is allowed to add a member to the portal.

Definition at line 106 of file RegistrationTool.py.

00106 
00107     def isRegistrationAllowed(self, REQUEST):
00108         '''Returns a boolean value indicating whether the user
00109         is allowed to add a member to the portal.
00110         '''
00111         return _checkPermission(AddPortalMember, self.aq_inner.aq_parent)

Here is the call graph for this function:

def CMFCore.RegistrationTool.RegistrationTool.mailPassword (   self,
  forgotten_userid,
  REQUEST 
)
Email a forgotten password to a member.  Raises an exception
if user ID is not found.

Definition at line 194 of file RegistrationTool.py.

00194 
00195     def mailPassword(self, forgotten_userid, REQUEST):
00196         '''Email a forgotten password to a member.  Raises an exception
00197         if user ID is not found.
00198         '''
00199         raise NotImplementedError
00200 
00201 InitializeClass(RegistrationTool)
def CMFCore.RegistrationTool.RegistrationTool.manage_editIDPattern (   self,
  pattern,
  REQUEST = None 
)
Edit the allowable member ID pattern TTW

Definition at line 75 of file RegistrationTool.py.

00075 
00076     def manage_editIDPattern(self, pattern, REQUEST=None):
00077         """Edit the allowable member ID pattern TTW"""
00078         pattern.strip()
00079 
00080         if len(pattern) > 0:
00081             self.member_id_pattern = pattern
00082             self._ALLOWED_MEMBER_ID_PATTERN = re.compile(pattern)
00083         else:
00084             self.member_id_pattern = ''
00085             self._ALLOWED_MEMBER_ID_PATTERN = re.compile(
00086                                                 self.default_member_id_pattern)
00087 
00088         if REQUEST is not None:
00089             msg = 'Member ID Pattern changed'
00090             return self.manage_configuration(manage_tabs_message=msg)

def CMFCore.RegistrationTool.RegistrationTool.testPasswordValidity (   self,
  password,
  confirm = None 
)
If the password is valid, returns None.  If not, returns
a string explaining why.

Definition at line 113 of file RegistrationTool.py.

00113 
00114     def testPasswordValidity(self, password, confirm=None):
00115         '''If the password is valid, returns None.  If not, returns
00116         a string explaining why.
00117         '''
00118         return None

Here is the caller graph for this function:

def CMFCore.RegistrationTool.RegistrationTool.testPropertiesValidity (   self,
  new_properties,
  member = None 
)
If the properties are valid, returns None.  If not, returns
a string explaining why.

Definition at line 120 of file RegistrationTool.py.

00120 
00121     def testPropertiesValidity(self, new_properties, member=None):
00122         '''If the properties are valid, returns None.  If not, returns
00123         a string explaining why.
00124         '''
00125         return None

Here is the caller graph for this function:


Member Data Documentation

tuple CMFCore.RegistrationTool.RegistrationTool.__implements__ = (z2IRegistrationTool, ) [static, private]

Definition at line 48 of file RegistrationTool.py.

Definition at line 54 of file RegistrationTool.py.

Definition at line 81 of file RegistrationTool.py.

string CMFCore.RegistrationTool.RegistrationTool.default_member_id_pattern = "^[A-Za-z][A-Za-z0-9_]*$" [static]

Definition at line 53 of file RegistrationTool.py.

string CMFCore.RegistrationTool.RegistrationTool.id = 'portal_registration' [static]

Definition at line 50 of file RegistrationTool.py.

tuple CMFCore.RegistrationTool.RegistrationTool.manage_configuration = DTMLFile('configureRegistrationTool', _dtmldir) [static]

Definition at line 72 of file RegistrationTool.py.

Initial value:
( ({'label': 'Overview',
                         'action': 'manage_overview'},
                        {'label': 'Configure',
                         'action': 'manage_configuration'})
                     + SimpleItem.manage_options
                     )

Definition at line 58 of file RegistrationTool.py.

tuple CMFCore.RegistrationTool.RegistrationTool.manage_overview = DTMLFile( 'explainRegistrationTool', _dtmldir ) [static]

Definition at line 69 of file RegistrationTool.py.

Definition at line 52 of file RegistrationTool.py.

Definition at line 80 of file RegistrationTool.py.

string CMFCore.RegistrationTool.RegistrationTool.meta_type = 'CMF Registration Tool' [static]

Definition at line 51 of file RegistrationTool.py.

tuple CMFCore.RegistrationTool.RegistrationTool.security = ClassSecurityInfo() [static]

Definition at line 56 of file RegistrationTool.py.


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