Back to index

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

List of all members.

Public Member Functions

def changePassword
def setRoles
def addRole
def removeRole
def setPassword
def setDomains
def addDomain
def removeDomain
def setGroups
def addGroup
def removeGroup
def getRealId
def clearCachedGroupsAndRoles
def isGroup
def getUserSourceId
def getGroupNames
def getGroupIds
def getAllGroups
def getAllGroupNames
def getAllGroupIds
def getGroups
def getImmediateGroups
def getGroupsWithoutPrefix
def getUserNameWithoutGroupPrefix
def getUserId
def getName
def getUserName
def getId
def getRoles
def getUserRoles
def getGroupRoles
def getRolesInContext
def getDomains
def getProperty
def hasProperty
def setProperty
def authenticate
def allowed
def hasRole
def __getattr__
def getUnwrappedUser
def __getitem__
def asHTML
def isInGroup

Public Attributes

 id

Static Public Attributes

tuple security = ClassSecurityInfo()
tuple changePassword = postonly(changePassword)

Private Member Functions

def _getPassword

Private Attributes

 _original_domains

Static Private Attributes

tuple __implements__ = (IUser, )

Detailed Description

This is the class for actual user objects

Definition at line 647 of file GRUFUser.py.


Member Function Documentation

def GroupUserFolder.GRUFUser.GRUFUserAtom.__getattr__ (   self,
  name 
) [inherited]

Definition at line 586 of file GRUFUser.py.

00586 
00587     def __getattr__(self, name):
00588         # This will call the underlying object's methods
00589         # if they are not found in this user object.
00590         # We will have to check Chris' http://www.plope.com/Members/chrism/plone_on_zope_head
00591         # to make it work with Zope HEAD.
00592         ret = getattr(self.__dict__['__underlying__'], name)
00593         return ret

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.__getitem__ (   self,
  name 
) [inherited]

Definition at line 601 of file GRUFUser.py.

00601 
00602     def __getitem__(self, name):
00603         # This will call the underlying object's methods
00604         # if they are not found in this user object.
00605         return self.__underlying__[name]

Here is the caller graph for this function:

Return the password of the user.

Definition at line 749 of file GRUFUser.py.

00749 
00750     def _getPassword(self):
00751         """Return the password of the user."""
00752         return self._original_password

def GroupUserFolder.GRUFUser.GRUFUser.addDomain (   self,
  domain 
)
Append a domain to a user

Definition at line 712 of file GRUFUser.py.

00712 
00713     def addDomain(self, domain):
00714         """Append a domain to a user
00715         """
00716         self.clearCachedGroupsAndRoles()
00717         self._GRUF.userAddDomain(self.getId(), domain)
00718         self._original_domains = self._GRUF.userGetDomains(self.getId())

def GroupUserFolder.GRUFUser.GRUFUser.addGroup (   self,
  groupname 
)
add a group to a user atom

Definition at line 735 of file GRUFUser.py.

00735 
00736     def addGroup(self, groupname):
00737         """add a group to a user atom
00738         """
00739         self.clearCachedGroupsAndRoles()
00740         return self._GRUF.userAddGroup(self.getId(), groupname)

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUser.addRole (   self,
  role 
)
Append a role for a user atom

Definition at line 683 of file GRUFUser.py.

00683 
00684     def addRole(self, role):
00685         """Append a role for a user atom
00686         """
00687         self.clearCachedGroupsAndRoles()
00688         return self._GRUF.userAddRole(self.getId(), role)

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.allowed (   self,
  object,
  object_roles = None 
) [inherited]
Check whether the user has access to object. The user must
   have one of the roles in object_roles to allow access.

Definition at line 478 of file GRUFUser.py.

00478 
00479     def allowed(self, object, object_roles=None):
00480         """Check whether the user has access to object. The user must
00481            have one of the roles in object_roles to allow access."""
00482 
00483         if object_roles is _what_not_even_god_should_do:
00484             return 0
00485 
00486         # Short-circuit the common case of anonymous access.
00487         if object_roles is None or 'Anonymous' in object_roles:
00488             return 1
00489 
00490         # Provide short-cut access if object is protected by 'Authenticated'
00491         # role and user is not nobody
00492         if 'Authenticated' in object_roles and \
00493             (self.getUserName() != 'Anonymous User'):
00494             return 1
00495 
00496         # Check for ancient role data up front, convert if found.
00497         # This should almost never happen, and should probably be
00498         # deprecated at some point.
00499         if 'Shared' in object_roles:
00500             object_roles = self._shared_roles(object)
00501             if object_roles is None or 'Anonymous' in object_roles:
00502                 return 1
00503 
00504 
00505         # Trying to make some speed improvements, changes starts here.
00506         # Helge Tesdal, Plone Solutions AS, http://www.plonesolutions.com
00507         # We avoid using the getRoles() and getRolesInContext() methods to be able
00508         # to short circuit.
00509 
00510         # Dict for faster lookup and avoiding duplicates
00511         object_roles_dict = {}
00512         for role in object_roles:
00513             object_roles_dict[role] = 1
00514 
00515         if [role for role in self.getUserRoles() if object_roles_dict.has_key(role)]:
00516             if self._check_context(object):
00517                 return 1
00518             return None
00519 
00520         # Try the top level group roles.
00521         if [role for role in self.getGroupRoles() if object_roles_dict.has_key(role)]:
00522             if self._check_context(object):
00523                 return 1
00524             return None
00525 
00526         user_groups = self.getGroups()
00527         # No luck on the top level, try local roles
00528         inner_obj = getattr(object, 'aq_inner', object)
00529         userid = self.getId()
00530         while 1:
00531             local_roles = getattr(inner_obj, '__ac_local_roles__', None)
00532             if local_roles:
00533                 if callable(local_roles):
00534                     local_roles = local_roles()
00535                 dict = local_roles or {}
00536 
00537                 if [role for role in dict.get(userid, []) if object_roles_dict.has_key(role)]:
00538                     if self._check_context(object):
00539                         return 1
00540                     return None
00541 
00542                 # Get roles & local roles for groups
00543                 # This handles nested groups as well
00544                 for groupid in user_groups:
00545                     if [role for role in dict.get(groupid, []) if object_roles_dict.has_key(role)]:
00546                         if self._check_context(object):
00547                             return 1
00548                         return None
00549 
00550             # LocalRole blocking
00551             obj = getattr(inner_obj, 'aq_base', inner_obj)
00552             if getattr(obj, '__ac_local_roles_block__', None):
00553                 break
00554 
00555             # Loop control
00556             inner = getattr(inner_obj, 'aq_inner', inner_obj)
00557             parent = getattr(inner, 'aq_parent', None)
00558             if parent is not None:
00559                 inner_obj = parent
00560                 continue
00561             if hasattr(inner_obj, 'im_self'):
00562                 inner_obj=inner_obj.im_self
00563                 inner_obj=getattr(inner_obj, 'aq_inner', inner_obj)
00564                 continue
00565             break
00566         return None
00567 

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.asHTML (   self,
  implicit = 0 
) [inherited]
asHTML(self, implicit=0) => HTML string
Used to generate homogeneous links for management screens

Definition at line 610 of file GRUFUser.py.

00610 
00611     def asHTML(self, implicit=0):
00612         """
00613         asHTML(self, implicit=0) => HTML string
00614         Used to generate homogeneous links for management screens
00615         """
00616         acl_users = self.acl_users
00617         if self.isGroup():
00618             color = acl_users.group_color
00619             kind = "Group"
00620         else:
00621             color = acl_users.user_color
00622             kind = "User"
00623 
00624         ret = '''<a href="%(href)s" alt="%(alt)s"><font color="%(color)s">%(name)s</font></a>''' % {
00625             "color": color,
00626             "href": "%s/%s/manage_workspace?FORCE_USER=1" % (acl_users.absolute_url(), self.getId(), ),
00627             "name": self.getUserNameWithoutGroupPrefix(),
00628             "alt": "%s (%s)" % (self.getUserNameWithoutGroupPrefix(), kind, ),
00629             }
00630         if implicit:
00631             return "<i>%s</i>" % ret
00632         return ret
00633 
    
def GroupUserFolder.GRUFUser.GRUFUserAtom.authenticate (   self,
  password,
  request 
) [inherited]

Definition at line 470 of file GRUFUser.py.

00470 
00471     def authenticate(self, password, request):
00472         # We prevent groups from authenticating
00473         if self._isGroup:
00474             return None
00475         return self.__underlying__.authenticate(password, request)
00476 

def GroupUserFolder.GRUFUser.GRUFUser.changePassword (   self,
  password,
  REQUEST = None 
)
Set the user's password. This method performs its own security checks

Definition at line 660 of file GRUFUser.py.

00660 
00661     def changePassword(self, password, REQUEST=None):
00662         """Set the user's password. This method performs its own security checks"""
00663         # Check security
00664         user = getSecurityManager().getUser()
00665         if not user.has_permission(Permissions.manage_users, self._GRUF):       # Is manager ?
00666             if user.__class__.__name__ != "GRUFUser":
00667                 raise "Unauthorized", "You cannot change someone else's password."
00668             if not user.getId() == self.getId():    # Is myself ?
00669                 raise "Unauthorized", "You cannot change someone else's password."
00670         
00671         # Just do it
00672         self.clearCachedGroupsAndRoles()
        return self._GRUF.userSetPassword(self.getId(), password)
def GroupUserFolder.GRUFUser.GRUFUserAtom.clearCachedGroupsAndRoles (   self,
  underlying_user = None 
) [inherited]

Definition at line 128 of file GRUFUser.py.

00128 
00129     def clearCachedGroupsAndRoles(self, underlying_user = None):
00130         self._groups = None
00131         self._user_roles = None
00132         self._group_roles = None
00133         self._all_roles = None
00134         if underlying_user:
00135             self._setUnderlying(underlying_user)
00136         self._original_user_roles = None

Here is the caller graph for this function:

...

Definition at line 173 of file GRUFUser.py.

00173 
00174     def getAllGroupIds(self,):
00175         """..."""
00176         return list(self._getGroups())

Here is the call graph for this function:

Here is the caller graph for this function:

...

Definition at line 167 of file GRUFUser.py.

00167 
00168     def getAllGroupNames(self,):
00169         """..."""
00170         ret = self._getGroups()
00171         return map(lambda x: x[GROUP_PREFIX_LEN:], ret)

Here is the call graph for this function:

Same as getAllGroupNames()

Definition at line 162 of file GRUFUser.py.

00162 
00163     def getAllGroups(self,):
00164         """Same as getAllGroupNames()"""
00165         return self.getAllGroupIds()

Here is the call graph for this function:

Return the list of domain restrictions for a user

Definition at line 401 of file GRUFUser.py.

00401 
00402     def getDomains(self):
00403         """Return the list of domain restrictions for a user"""
00404         return self._original_domains
00405 

...

Definition at line 157 of file GRUFUser.py.

00157 
00158     def getGroupIds(self,):
00159         """..."""
00160         return list(self._getGroups(no_recurse = 1))

Here is the call graph for this function:

Here is the caller graph for this function:

...

Definition at line 151 of file GRUFUser.py.

00151 
00152     def getGroupNames(self,):
00153         """..."""
00154         ret = self._getGroups(no_recurse = 1)
00155         return map(lambda x: x[GROUP_PREFIX_LEN:], ret)

Here is the call graph for this function:

Return the tuple of roles belonging to this user's group(s)

Definition at line 326 of file GRUFUser.py.

00326 
00327     def getGroupRoles(self,):
00328         """
00329         Return the tuple of roles belonging to this user's group(s)
00330         """
00331         if self._group_roles is not None:
00332             return self._group_roles
00333         ret = []
00334         acl_users = self._GRUF.acl_users 
00335         groups = acl_users.getGroupIds()      # XXX We can have a cache here
00336         
00337         for group in self.getGroups():
00338             if not group in groups:
00339                 Log("Group", group, "is invalid. Ignoring.")
00340                 # This may occur when groups are deleted
00341                 # Ignored silently
00342                 continue
00343             ret.extend(acl_users.getGroup(group).getUserRoles())
00344 
00345         self._group_roles = GroupUserFolder.unique(ret)
00346         return self._group_roles

Here is the call graph for this function:

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.getGroups (   self,
  args,
  kw 
) [inherited]
...

Definition at line 178 of file GRUFUser.py.

00178 
00179     def getGroups(self, *args, **kw):
00180         """..."""
00181         ret = self._getGroups(*args, **kw)
00182         return list(ret)

Here is the call graph for this function:

Here is the caller graph for this function:

Same as getGroups but return them without a prefix.

Definition at line 250 of file GRUFUser.py.

00250 
00251     def getGroupsWithoutPrefix(self, **kw):
00252         """
00253         Same as getGroups but return them without a prefix.
00254         """
00255         ret = []
00256         for group in self.getGroups(**kw):
00257           if group.startswith(GROUP_PREFIX):
00258             ret.append(group[len(GROUP_PREFIX):])
00259         return ret

Here is the call graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.getId (   self,
  unprefixed = 0 
) [inherited]
Get the ID of the user. The ID can be used, at least from
Python, to get the user from the user's UserDatabase

Definition at line 290 of file GRUFUser.py.

00290 
00291     def getId(self, unprefixed = 0):
00292         """Get the ID of the user. The ID can be used, at least from
00293         Python, to get the user from the user's UserDatabase
00294         """
00295         # Return the right id
00296         if self.isGroup() and not self._original_name.startswith(GROUP_PREFIX) and not unprefixed:
00297             return "%s%s" % (GROUP_PREFIX, self._original_name)
00298         return self._original_name

Here is the call graph for this function:

Return NON-TRANSITIVE groups

Definition at line 184 of file GRUFUser.py.

00184 
00185     def getImmediateGroups(self,):
00186         """
00187         Return NON-TRANSITIVE groups
00188         """
00189         ret = self._getGroups(no_recurse = 1)
00190         return list(ret)
    

Here is the call graph for this function:

Get user's or group's name.
For a user, the name can be set by the underlying user folder but usually id == name.
For a group, the ID is prefixed, but the NAME is NOT prefixed by 'group_'.

Definition at line 277 of file GRUFUser.py.

00277 
00278     def getName(self,):
00279         """Get user's or group's name.
00280         For a user, the name can be set by the underlying user folder but usually id == name.
00281         For a group, the ID is prefixed, but the NAME is NOT prefixed by 'group_'.
00282         """
00283         return self.getUserNameWithoutGroupPrefix()

Here is the call graph for this function:

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.getProperty (   self,
  name,
  default = _marker 
) [inherited]
getProperty(self, name) => return property value or raise AttributeError

Definition at line 407 of file GRUFUser.py.

00407 
00408     def getProperty(self, name, default=_marker):
00409         """getProperty(self, name) => return property value or raise AttributeError
00410         """
00411         # Try to do an attribute lookup on the underlying user object
00412         v = getattr(self.__underlying__, name, default)
00413         if v is _marker:
00414             raise AttributeError, name
00415         return v

Here is the caller graph for this function:

Return id WITHOUT group prefix

Reimplemented from GroupUserFolder.GRUFUser.GRUFUserAtom.

Definition at line 754 of file GRUFUser.py.

00754 
00755     def getRealId(self,):
00756         """Return id WITHOUT group prefix
00757         """
00758         return self.getId()
00759 

Return the list (tuple) of roles assigned to a user.
THIS IS WHERE THE ATHENIANS REACHED !

Definition at line 300 of file GRUFUser.py.

00300 
00301     def getRoles(self):
00302         """
00303         Return the list (tuple) of roles assigned to a user.
00304         THIS IS WHERE THE ATHENIANS REACHED !
00305         """
00306         if self._all_roles is not None:
00307             return self._all_roles
00308 
00309         # Return user and groups roles
00310         self._all_roles = GroupUserFolder.unique(self.getUserRoles() + self.getGroupRoles())
00311         return self._all_roles

Here is the call graph for this function:

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.getRolesInContext (   self,
  object,
  userid = None 
) [inherited]
Return the list of roles assigned to the user,
including local roles assigned in context of
the passed in object.

Definition at line 348 of file GRUFUser.py.

00348 
00349     def getRolesInContext(self, object, userid = None):
00350         """
00351         Return the list of roles assigned to the user,
00352         including local roles assigned in context of
00353         the passed in object.
00354         """
00355         if not userid:
00356             userid=self.getId()
00357 
00358         roles = {}
00359         for role in self.getRoles():
00360             roles[role] = 1
00361 
00362         user_groups = self.getGroups()
00363 
00364         inner_obj = getattr(object, 'aq_inner', object)
00365         while 1:
00366             # Usual local roles retreiving
00367             local_roles = getattr(inner_obj, '__ac_local_roles__', None)
00368             if local_roles:
00369                 if callable(local_roles):
00370                     local_roles = local_roles()
00371                 dict = local_roles or {}
00372 
00373                 for role in dict.get(userid, []):
00374                     roles[role] = 1
00375 
00376                 # Get roles & local roles for groups
00377                 # This handles nested groups as well
00378                 for groupid in user_groups:
00379                     for role in dict.get(groupid, []):
00380                         roles[role] = 1
00381                         
00382             # LocalRole blocking
00383             obj = getattr(inner_obj, 'aq_base', inner_obj)
00384             if getattr(obj, '__ac_local_roles_block__', None):
00385                 break
00386 
00387             # Loop management
00388             inner = getattr(inner_obj, 'aq_inner', inner_obj)
00389             parent = getattr(inner, 'aq_parent', None)
00390             if parent is not None:
00391                 inner_obj = parent
00392                 continue
00393             if hasattr(inner_obj, 'im_self'):
00394                 inner_obj=inner_obj.im_self
00395                 inner_obj=getattr(inner_obj, 'aq_inner', inner_obj)
00396                 continue
00397             break
00398 
00399         return tuple(roles.keys())

same as GRUF.getUnwrappedUser, but implicitly with this particular user

Definition at line 595 of file GRUFUser.py.

00595 
00596     def getUnwrappedUser(self,):
00597         """
00598         same as GRUF.getUnwrappedUser, but implicitly with this particular user
00599         """
00600         return self.__dict__['__underlying__']

Return the user id of a user

Definition at line 269 of file GRUFUser.py.

00269 
00270     def getUserId(self):
00271         """Return the user id of a user"""
00272         if self.isGroup() and \
00273           not self._original_name[:len(GROUP_PREFIX)] == GROUP_PREFIX:
00274             return "%s%s" % (GROUP_PREFIX, self._original_name )
00275         return self._original_name

Here is the call graph for this function:

Alias for getName()

Definition at line 285 of file GRUFUser.py.

00285 
00286     def getUserName(self,):
00287         """Alias for getName()"""
00288         return self.getUserNameWithoutGroupPrefix()
    

Here is the call graph for this function:

Here is the caller graph for this function:

Return the username of a user without a group prefix

Definition at line 261 of file GRUFUser.py.

00261 
00262     def getUserNameWithoutGroupPrefix(self):
00263         """Return the username of a user without a group prefix"""
00264         if self.isGroup() and \
00265           self._original_name[:len(GROUP_PREFIX)] == GROUP_PREFIX:
00266             return self._original_name[len(GROUP_PREFIX):]
00267         return self._original_name

Here is the call graph for this function:

Here is the caller graph for this function:

returns the roles defined for the user without the group roles

Definition at line 313 of file GRUFUser.py.

00313 
00314     def getUserRoles(self):
00315         """
00316         returns the roles defined for the user without the group roles
00317         """
00318         if self._user_roles is not None:
00319             return self._user_roles
00320         prefix = GROUP_PREFIX
00321         if self._original_user_roles is None:
00322             self._original_user_roles = self.__underlying__.getRoles()
00323         self._user_roles = tuple([r for r in self._original_user_roles if not r.startswith(prefix)])
00324         return self._user_roles

Here is the caller graph for this function:

getUserSourceId(self,) => string
Return the GRUF's GRUFUsers folder used to fetch this user.

Definition at line 143 of file GRUFUser.py.

00143 
00144     def getUserSourceId(self,):
00145         """
00146         getUserSourceId(self,) => string
00147         Return the GRUF's GRUFUsers folder used to fetch this user.
00148         """
00149         return self._source_id

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.hasProperty (   self,
  name 
) [inherited]
hasProperty

Definition at line 417 of file GRUFUser.py.

00417 
00418     def hasProperty(self, name):
00419         """hasProperty"""
00420         return hasattr(self.__underlying__, name)

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.hasRole (   self,
  args,
  kw 
) [inherited]
hasRole is an alias for 'allowed' and has been deprecated.

Code still using this method should convert to either 'has_role' or
'allowed', depending on the intended behaviour.

Definition at line 569 of file GRUFUser.py.

00569 
00570     def hasRole(self, *args, **kw):
00571         """hasRole is an alias for 'allowed' and has been deprecated.
00572 
00573         Code still using this method should convert to either 'has_role' or
00574         'allowed', depending on the intended behaviour.
00575 
00576         """
00577         import warnings
00578         warnings.warn('BasicUser.hasRole is deprecated, please use '
00579             'BasicUser.allowed instead; hasRole was an alias for allowed, but '
00580             'you may have ment to use has_role.', DeprecationWarning)
00581         return self.allowed(*args, **kw)

Here is the call graph for this function:

Return 1 if this user is a group abstraction

Definition at line 138 of file GRUFUser.py.

00138 
00139     def isGroup(self,):
00140         """Return 1 if this user is a group abstraction"""
00141         return self._isGroup

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUserAtom.isInGroup (   self,
  groupid 
) [inherited]
Return true if the user is member of the specified group id
(including transitive groups)

Definition at line 635 of file GRUFUser.py.

00635 
00636     def isInGroup(self, groupid):
00637         """Return true if the user is member of the specified group id
00638         (including transitive groups)"""
00639         return groupid in self.getAllGroupIds()

Here is the call graph for this function:

def GroupUserFolder.GRUFUser.GRUFUser.removeDomain (   self,
  domain 
)
Remove a domain from a user

Definition at line 720 of file GRUFUser.py.

00720 
00721     def removeDomain(self, domain):
00722         """Remove a domain from a user
00723         """
00724         self.clearCachedGroupsAndRoles()
00725         self._GRUF.userRemoveDomain(self.getId(), domain)
00726         self._original_domains = self._GRUF.userGetDomains(self.getId())

def GroupUserFolder.GRUFUser.GRUFUser.removeGroup (   self,
  groupname 
)
remove a group from a user atom.

Definition at line 742 of file GRUFUser.py.

00742 
00743     def removeGroup(self, groupname):
00744         """remove a group from a user atom.
00745         """
00746         self.clearCachedGroupsAndRoles()
00747         return self._GRUF.userRemoveGroup(self.getId(), groupname)

Here is the caller graph for this function:

Remove the role of a user atom

Definition at line 690 of file GRUFUser.py.

00690 
00691     def removeRole(self, role):
00692         """Remove the role of a user atom
00693         """
00694         self.clearCachedGroupsAndRoles()
00695         return self._GRUF.userRemoveRole(self.getId(), role)

def GroupUserFolder.GRUFUser.GRUFUser.setDomains (   self,
  domains 
)
Set domains for a user

Definition at line 704 of file GRUFUser.py.

00704 
00705     def setDomains(self, domains):
00706         """Set domains for a user
00707         """
00708         self.clearCachedGroupsAndRoles()
00709         self._GRUF.userSetDomains(self.getId(), domains)
00710         self._original_domains = self._GRUF.userGetDomains(self.getId())

def GroupUserFolder.GRUFUser.GRUFUser.setGroups (   self,
  groupnames 
)
Set the groups of a user

Definition at line 728 of file GRUFUser.py.

00728 
00729     def setGroups(self, groupnames):
00730         """Set the groups of a user
00731         """
00732         self.clearCachedGroupsAndRoles()
00733         return self._GRUF.userSetGroups(self.getId(), groupnames)

Here is the caller graph for this function:

def GroupUserFolder.GRUFUser.GRUFUser.setPassword (   self,
  newPassword 
)
Set the password of a user

Definition at line 697 of file GRUFUser.py.

00697 
00698     def setPassword(self, newPassword):
00699         """Set the password of a user
00700         """
00701         self.clearCachedGroupsAndRoles()
00702         return self._GRUF.userSetPassword(self.getId(), newPassword)

def GroupUserFolder.GRUFUser.GRUFUserAtom.setProperty (   self,
  name,
  value 
) [inherited]
setProperty => Try to set the property...
By now, it's available only for LDAPUserFolder

Definition at line 422 of file GRUFUser.py.

00422 
00423     def setProperty(self, name, value):
00424         """setProperty => Try to set the property...
00425         By now, it's available only for LDAPUserFolder
00426         """
00427         # Get actual source
00428         src = self._GRUF.getUserSource(self.getUserSourceId())
00429         if not src:
00430             raise RuntimeError, "Invalid or missing user source for '%s'." % (self.getId(),)
00431 
00432         # LDAPUserFolder => specific API.
00433         if hasattr(src, "manage_setUserProperty"):
00434             # Unmap pty name if necessary, get it in the schema
00435             ldapname = None
00436             for schema in src.getSchemaConfig().values():
00437                 if schema["ldap_name"] == name:
00438                     ldapname = schema["ldap_name"]
00439                 if schema["public_name"] == name:
00440                     ldapname = schema["ldap_name"]
00441                     break
00442 
00443             # If we didn't find it, we skip it
00444             if ldapname is None:
00445                 raise KeyError, "Invalid LDAP attribute: '%s'." % (name, )
00446             
00447             # Edit user
00448             user_dn = src._find_user_dn(self.getUserName())
00449             src.manage_setUserProperty(user_dn, ldapname, value)
00450 
00451             # Expire the underlying user object
00452             self.__underlying__ = src.getUser(self.getId())
00453             if not self.__underlying__:
00454                 raise RuntimeError, "Error while setting property of '%s'." % (self.getId(),)
00455 
00456         # Now we check if the property has been changed
00457         if not self.hasProperty(name):
00458             raise NotImplementedError, "Property setting is not supported for '%s'." % (name,)
00459         v = self._GRUF.getUserById(self.getId()).getProperty(name)
00460         if not v == value:
00461             Log(LOG_DEBUG, "Property '%s' for user '%s' should be '%s' and not '%s'" % (
00462                 name, self.getId(), value, v,
00463                 ))
00464             raise NotImplementedError, "Property setting is not supported for '%s'." % (name,)

def GroupUserFolder.GRUFUser.GRUFUser.setRoles (   self,
  roles 
)
Change the roles of a user atom.

Definition at line 676 of file GRUFUser.py.

00676 
00677     def setRoles(self, roles):
00678         """Change the roles of a user atom.
00679         """
00680         self.clearCachedGroupsAndRoles()
00681         return self._GRUF.userSetRoles(self.getId(), roles)


Member Data Documentation

tuple GroupUserFolder.GRUFUser.GRUFUser.__implements__ = (IUser, ) [static, private]

Definition at line 651 of file GRUFUser.py.

Reimplemented from GroupUserFolder.GRUFUser.GRUFUserAtom.

Definition at line 709 of file GRUFUser.py.

Definition at line 673 of file GRUFUser.py.

Definition at line 121 of file GRUFUser.py.

tuple GroupUserFolder.GRUFUser.GRUFUser.security = ClassSecurityInfo() [static]

Reimplemented from GroupUserFolder.GRUFUser.GRUFUserAtom.

Definition at line 653 of file GRUFUser.py.


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