Back to index

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

List of all members.

Public Member Functions

def __init__
def isGroup
def getName
def getUserId
def getGroupNames
def getPropertysheet
 acquisition aware
def addPropertysheet
def getOrderedPropertySheets
def getRolesInContext
def allowed
def setProperties
def getProperty

Static Public Attributes

tuple security = ClassSecurityInfo()
 getGroupIds = getGroupNames

Private Member Functions

def _getPAS
def _getPlugins
def _getPropertyPlugins
def _getLocalRolesPlugins
 local roles plugin type delegation

Private Attributes

 _propertysheets

Static Private Attributes

 _isGroup = False
 GRUF API.

Detailed Description

Definition at line 71 of file ufactory.py.


Constructor & Destructor Documentation

def PlonePAS.plugins.ufactory.PloneUser.__init__ (   self,
  id,
  login = None 
)

Definition at line 79 of file ufactory.py.

00079 
00080     def __init__( self, id, login=None ):
00081         super( PloneUser, self).__init__( id, login )
00082         self._propertysheets = OrderedDict()


Member Function Documentation

local roles plugin type delegation

Definition at line 156 of file ufactory.py.

00156 
00157     def _getLocalRolesPlugins(self):
00158         return self._getPAS().plugins.listPlugins(ILocalRolesPlugin)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 83 of file ufactory.py.

00083 
00084     def _getPAS(self):
00085         # XXX This is not very optimal *at all*
00086         return self.acl_users
        

Here is the caller graph for this function:

Definition at line 87 of file ufactory.py.

00087 
00088     def _getPlugins(self):
00089         # XXX This is not very optimal *at all*
00090         return self._getPAS().plugins

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 146 of file ufactory.py.

00146 
00147     def _getPropertyPlugins(self):
00148         return self._getPAS().plugins.listPlugins(IPropertiesPlugin)

Here is the call graph for this function:

def PlonePAS.plugins.ufactory.PloneUser.addPropertysheet (   self,
  id,
  data 
)
-> add a prop sheet, given data which is either
a property sheet or a raw mapping.

Definition at line 132 of file ufactory.py.

00132 
00133     def addPropertysheet(self, id, data):
00134         """ -> add a prop sheet, given data which is either
00135         a property sheet or a raw mapping.
00136         """
00137         if IPropertySheet.providedBy(data):
00138             sheet = data
00139         else:
00140             sheet = UserPropertySheet(id, **data)
00141 
00142         if self._propertysheets.get(id) is not None:
00143             raise KeyError, 'Duplicate property sheet: %s' % id
00144 
00145         self._propertysheets[id] = sheet

def PlonePAS.plugins.ufactory.PloneUser.allowed (   self,
  object,
  object_roles = None 
)

Definition at line 167 of file ufactory.py.

00167 
00168     def allowed(self, object, object_roles = None):
00169         if object_roles is _what_not_even_god_should_do:
00170             return 0
00171 
00172         # Short-circuit the common case of anonymous access.
00173         if object_roles is None or 'Anonymous' in object_roles:
00174             return 1
00175 
00176         # Provide short-cut access if object is protected by 'Authenticated'
00177         # role and user is not nobody
00178         if 'Authenticated' in object_roles and (
00179             self.getUserName() != 'Anonymous User'):
00180             return 1
00181 
00182         # Check for ancient role data up front, convert if found.
00183         # This should almost never happen, and should probably be
00184         # deprecated at some point.
00185         if 'Shared' in object_roles:
00186             object_roles = self._shared_roles(object)
00187             if object_roles is None or 'Anonymous' in object_roles:
00188                 return 1
00189 
00190         # Check for a role match with the normal roles given to
00191         # the user, then with local roles only if necessary. We
00192         # want to avoid as much overhead as possible.
00193         user_roles = self.getRoles()
00194         for role in object_roles:
00195             if role in user_roles:
00196                 if self._check_context(object):
00197                     return 1
00198                 return None
00199 
00200         # check for local roles
00201         lrmanagers = self._getLocalRolesPlugins()
00202 
00203         for lrid, lrm in lrmanagers:
00204             allowed = lrm.checkLocalRolesAllowed(self, object, object_roles)
00205             # return values
00206             # 0, 1, None
00207             # - 1 success
00208             # - 0 object context violation
00209             # - None - failure
00210             if allowed is None:
00211                 continue
00212             return allowed
00213         return None

Here is the call graph for this function:

Return ids of this user's groups. GRUF compat.

Definition at line 111 of file ufactory.py.

00111 
00112     def getGroupNames(self):
00113         """Return ids of this user's groups. GRUF compat."""
00114         return self.getGroups()

Here is the call graph for this function:

Get user's or group's name.
This is the id. PAS doesn't do prefixes and such like GRUF.

Definition at line 97 of file ufactory.py.

00097 
00098     def getName(self):
00099         """Get user's or group's name.
00100         This is the id. PAS doesn't do prefixes and such like GRUF.
00101         """
00102         return self.getId()

Here is the caller graph for this function:

Definition at line 150 of file ufactory.py.

00150 
00151     def getOrderedPropertySheets(self):
00152         return self._propertysheets.values()

Here is the caller graph for this function:

def PlonePAS.plugins.ufactory.PloneUser.getProperty (   self,
  id,
  default = _marker 
)

Definition at line 232 of file ufactory.py.

00232 
00233     def getProperty(self, id, default=_marker):
00234         for sheet in self.getOrderedPropertySheets():
00235             if sheet.hasProperty(id):
00236                 value=sheet.getProperty(id)
00237                 if isinstance(value, unicode):
00238                     # XXX Temporarily work around the fact that
00239                     # property sheets blindly store and return
00240                     # unicode. This is sub-optimal and should be
00241                     # dealed with at the property sheets level by
00242                     # using Zope's converters.
00243                     charset = getCharset(self)
00244                     return value.encode(charset)
00245                 return value
00246 
00247         return default
00248 
00249 InitializeClass(PloneUser)

Here is the call graph for this function:

Here is the caller graph for this function:

acquisition aware

-> propertysheet (wrapped if supported)

Definition at line 122 of file ufactory.py.

00122 
00123     def getPropertysheet(self, id):
00124         """ -> propertysheet (wrapped if supported)
00125         """
00126         sheet = self._propertysheets[id]
00127         try:
00128             return sheet.__of__(self)
00129         except AttributeError:
00130             return sheet

Definition at line 159 of file ufactory.py.

00159 
00160     def getRolesInContext(self, object):
00161         lrmanagers = self._getLocalRolesPlugins()
00162         roles = []
00163         for lrid, lrmanager in lrmanagers:
00164             roles.extend(lrmanager.getRolesInContext(self, object))
00165         roles.extend(self.getRoles())
00166         return unique(roles)

Here is the call graph for this function:

Get user's or group's name.
This is the id. PAS doesn't do prefixes and such like GRUF.

Definition at line 104 of file ufactory.py.

00104 
00105     def getUserId(self):
00106         """Get user's or group's name.
00107         This is the id. PAS doesn't do prefixes and such like GRUF.
00108         """
00109         return self.getId()

Return 1 if this user is a group abstraction

Definition at line 92 of file ufactory.py.

00092 
00093     def isGroup(self):
00094         """Return 1 if this user is a group abstraction"""
00095         return self._isGroup

def PlonePAS.plugins.ufactory.PloneUser.setProperties (   self,
  properties = None,
  kw 
)

Definition at line 214 of file ufactory.py.

00214 
00215     def setProperties(self, properties=None, **kw):
00216         if properties is None:
00217             properties=kw
00218 
00219         for sheet in self.getOrderedPropertySheets():
00220             if not IMutablePropertySheet.providedBy(sheet):
00221                 continue
00222 
00223             update={}
00224             for (key,value) in kw.items():
00225                 if sheet.hasProperty(key):
00226                     update[key]=value
00227                     del kw[key]
00228 
00229             if update:
00230                 sheet.setProperties(self, update)
00231 

Here is the call graph for this function:


Member Data Documentation

GRUF API.

Definition at line 77 of file ufactory.py.

Definition at line 81 of file ufactory.py.

Definition at line 116 of file ufactory.py.

tuple PlonePAS.plugins.ufactory.PloneUser.security = ClassSecurityInfo() [static]

Definition at line 73 of file ufactory.py.


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