Back to index

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

List of all members.

Public Member Functions

def manage_setMembersFolderById
def getRoster
def setMembersFolderById
def getMembersFolder
def createMemberArea
def getHomeFolder
def getHomeUrl

Public Attributes

 membersfolder_id

Static Public Attributes

string meta_type = 'Default Membership Tool'
string membersfolder_id = 'Members'
tuple security = ClassSecurityInfo()
tuple manage_overview = DTMLFile( 'explainMembershipTool', _dtmldir )
tuple manage_mapRoles = DTMLFile('membershipRolemapping', _dtmldir )
 createMemberarea = createMemberArea

Static Private Attributes

tuple __implements__ = (z2IMembershipTool, )

Detailed Description

Implement 'portal_membership' interface using "stock" policies.

Definition at line 51 of file MembershipTool.py.


Member Function Documentation

def CMFDefault.MembershipTool.MembershipTool.createMemberArea (   self,
  member_id = '' 
)
Create a member area for 'member_id' or authenticated user.

Definition at line 117 of file MembershipTool.py.

00117 
00118     def createMemberArea(self, member_id=''):
00119         """ Create a member area for 'member_id' or authenticated user.
00120         """
00121         if not self.getMemberareaCreationFlag():
00122             return None
00123         members = self.getMembersFolder()
00124         if members is None:
00125             return None
00126         if self.isAnonymousUser():
00127             return None
00128         # Note: We can't use getAuthenticatedMember() and getMemberById()
00129         # because they might be wrapped by MemberDataTool.
00130         user = _getAuthenticatedUser(self)
00131         user_id = user.getId()
00132         if member_id in ('', user_id):
00133             member = user
00134             member_id = user_id
00135         else:
00136             if _checkPermission(ManageUsers, self):
00137                 member = self.acl_users.getUserById(member_id, None)
00138                 if member:
00139                     member = member.__of__(self.acl_users)
00140                 else:
00141                     raise ValueError, 'Member %s does not exist' % member_id
00142             else:
00143                 return None
00144         if hasattr( aq_base(members), member_id ):
00145             return None
00146 
00147         # Note: We can't use invokeFactory() to add folder and content because
00148         # the user might not have the necessary permissions.
00149 
00150         # Create Member's home folder.
00151         members.manage_addPortalFolder(id=member_id,
00152                                        title="%s's Home" % member_id)
00153         f = members._getOb(member_id)
00154 
00155         # Grant Ownership and Owner role to Member
00156         f.changeOwnership(member)
00157         f.__ac_local_roles__ = None
00158         f.manage_setLocalRoles(member_id, ['Owner'])
00159 
00160         # Create Member's initial content.
00161         if hasattr(self, 'createMemberContent'):
00162             self.createMemberContent(member=member,
00163                                    member_id=member_id,
00164                                    member_folder=f)
00165         else:
00166             addDocument( f
00167                        , 'index_html'
00168                        , member_id+"'s Home"
00169                        , member_id+"'s front page"
00170                        , "structured-text"
00171                        , (DEFAULT_MEMBER_CONTENT % member_id)
00172                        )
00173 
00174             # Grant Ownership and Owner role to Member
00175             f.index_html.changeOwnership(member)
00176             f.index_html.__ac_local_roles__ = None
00177             f.index_html.manage_setLocalRoles(member_id, ['Owner'])
00178 
00179             f.index_html._setPortalTypeName( 'Document' )
00180             f.index_html.reindexObject()
00181             f.index_html.notifyWorkflowCreated()
00182         return f

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFDefault.MembershipTool.MembershipTool.getHomeFolder (   self,
  id = None,
  verifyPermission = 0 
)
Return a member's home folder object, or None.

Definition at line 186 of file MembershipTool.py.

00186 
00187     def getHomeFolder(self, id=None, verifyPermission=0):
00188         """ Return a member's home folder object, or None.
00189         """
00190         if id is None:
00191             member = self.getAuthenticatedMember()
00192             if not hasattr(member, 'getMemberId'):
00193                 return None
00194             id = member.getMemberId()
00195         members = self.getMembersFolder()
00196         if members:
00197             try:
00198                 folder = members._getOb(id)
00199                 if verifyPermission and not _checkPermission(View, folder):
00200                     # Don't return the folder if the user can't get to it.
00201                     return None
00202                 return folder
00203             except (AttributeError, TypeError, KeyError):
00204                 pass
00205         return None

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFDefault.MembershipTool.MembershipTool.getHomeUrl (   self,
  id = None,
  verifyPermission = 0 
)
Return the URL to a member's home folder, or None.

Definition at line 206 of file MembershipTool.py.

00206 
00207     def getHomeUrl(self, id=None, verifyPermission=0):
00208         """ Return the URL to a member's home folder, or None.
00209         """
00210         home = self.getHomeFolder(id, verifyPermission)
00211         if home is not None:
00212             return home.absolute_url()
00213         else:
00214             return None
00215 
00216 InitializeClass(MembershipTool)

Here is the call graph for this function:

Get the members folder object.

Definition at line 109 of file MembershipTool.py.

00109 
00110     def getMembersFolder(self):
00111         """ Get the members folder object.
00112         """
00113         parent = aq_parent( aq_inner(self) )
00114         members = getattr(parent, self.membersfolder_id, None)
00115         return members

Here is the caller graph for this function:

Return a list of mappings for 'listed' members.

If Manager, return a list of all usernames.  The mapping
contains the id and listed variables.

Definition at line 88 of file MembershipTool.py.

00088 
00089     def getRoster(self):
00090         """ Return a list of mappings for 'listed' members.
00091 
00092         If Manager, return a list of all usernames.  The mapping
00093         contains the id and listed variables.
00094         """
00095         isUserManager = _checkPermission(ManageUsers, self)
00096         roster = []
00097         for member in self.listMembers():
00098             if isUserManager or member.listed:
00099                 roster.append({'id':member.getId(),
00100                                'listed':member.listed})
00101         return roster

Here is the call graph for this function:

def CMFDefault.MembershipTool.MembershipTool.manage_setMembersFolderById (   self,
  id = '',
  REQUEST = None 
)
ZMI method to set the members folder object by its id.

Definition at line 74 of file MembershipTool.py.

00074 
00075     def manage_setMembersFolderById(self, id='', REQUEST=None):
00076         """ ZMI method to set the members folder object by its id.
00077         """
00078         self.setMembersFolderById(id)
00079         if REQUEST is not None:
00080             REQUEST['RESPONSE'].redirect( self.absolute_url()
00081                     + '/manage_mapRoles'
00082                     + '?manage_tabs_message=Members+folder+changed.'
00083                     )

Here is the call graph for this function:

Set the members folder object by its id.

Definition at line 103 of file MembershipTool.py.

00103 
00104     def setMembersFolderById(self, id=''):
00105         """ Set the members folder object by its id.
00106         """
00107         self.membersfolder_id = id.strip()

Here is the caller graph for this function:


Member Data Documentation

tuple CMFDefault.MembershipTool.MembershipTool.__implements__ = (z2IMembershipTool, ) [static, private]

Definition at line 57 of file MembershipTool.py.

Definition at line 184 of file MembershipTool.py.

tuple CMFDefault.MembershipTool.MembershipTool.manage_mapRoles = DTMLFile('membershipRolemapping', _dtmldir ) [static]

Definition at line 71 of file MembershipTool.py.

tuple CMFDefault.MembershipTool.MembershipTool.manage_overview = DTMLFile( 'explainMembershipTool', _dtmldir ) [static]

Definition at line 68 of file MembershipTool.py.

Definition at line 60 of file MembershipTool.py.

Definition at line 106 of file MembershipTool.py.

string CMFDefault.MembershipTool.MembershipTool.meta_type = 'Default Membership Tool' [static]

Definition at line 59 of file MembershipTool.py.

tuple CMFDefault.MembershipTool.MembershipTool.security = ClassSecurityInfo() [static]

Definition at line 62 of file MembershipTool.py.


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