Changeset 7a718e in indico
- Timestamp:
- 06/08/10 11:33:35 (3 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
- Children:
- 6e2ea5
- Parents:
- 9ea55a
- git-author:
- Pedro Ferreira <jose.pedro.ferreira@…> (06/01/10 11:37:25)
- git-committer:
- Jose Benito <jose.benito.gonzalez@…> (06/08/10 11:33:35)
- Location:
- indico/MaKaC
- Files:
-
- 2 edited
-
authentication/AuthenticationMgr.py (modified) (2 diffs)
-
plugins/Collaboration/Vidyo/common.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/authentication/AuthenticationMgr.py
r1035b2 r7a718e 78 78 return None 79 79 80 def getAvatarByLogin(self, login, auth enticator= None):80 def getAvatarByLogin(self, login, auth = None): 81 81 """ Returns an Avatar object based on the person's login. 82 If auth enticator is set, we will only look in the given authenticator.83 If not set, we will look in all authe ticators.82 If authList is set, we will only look in the given authenticators. 83 If not set, we will look in all authenticators. 84 84 If we find this login in more than one authenticator, and there is at least 2 85 85 different Avatar objects, we will return a dictionary authenticatorName:Avatar object. … … 89 89 :type login: str 90 90 91 :param login: the name of an authenticator to use, or a list of authenticator names, or None92 :type login: str, list or NoneType91 :param auth: a list of names of the authenticators to use, or None 92 :type auth: str, list or NoneType 93 93 """ 94 94 95 if type(authenticator) is str: 96 #only one authenticator 97 auth = self.getById(authenticator) 95 if auth == None: 96 # search all authenticators 97 authList = self.AuthenticatorList 98 else: 99 # get the actual Authenticator objects 100 authList = list(self.getById(a) for a in auth) 101 102 # we search for Avatars in each authenticator 103 foundAvatars = {} 104 for auth in authList: 98 105 try: 99 return auth.getAvatarByLogin(login) 106 avatar = auth.getAvatarByLogin(login) 107 foundAvatars[auth.getId().strip()] = avatar 100 108 except KeyError: 101 return None109 pass 102 110 103 else: 104 #multiple authenticators, we build a list of authenticators 105 if type(authenticator) is list: 106 authenticatorList = [] 107 for authName in authenticator: 108 authenticatorList.append(self.getById(authName)) 109 else: 110 authenticatorList = self.AuthenticatorList 111 112 #we search for Avatars in each authenticator 113 foundAvatars = {} 114 avatarIdsFound = set() 115 for auth in authenticatorList: 116 try: 117 avatar = auth.getAvatarByLogin(login) 118 foundAvatars[auth.getId().strip()] = avatar 119 avatarIdsFound.add(avatar.getId()) 120 except KeyError: 121 pass 122 123 if foundAvatars: 124 if len(foundAvatars) == 1 or len(avatarIdsFound) == 1: 125 #there's only one different avatar 126 return foundAvatars.values()[0] 127 else: 128 #there's more than 1 avatar, we return a dictionary 129 return foundAvatars 130 else: 131 #we found nothing, we return None 132 return None 133 111 return foundAvatars 134 112 135 113 def isLoginFree( self, login): -
indico/MaKaC/plugins/Collaboration/Vidyo/common.py
r7494a5 r7a718e 146 146 @classmethod 147 147 def getAvatarByAccountName(cls, accountName): 148 authenticatorsToUse = getVidyoOptionValue("authenticatorList") 149 150 foundAvatar = AuthenticatorMgr().getAvatarByLogin(accountName, authenticatorsToUse) 151 if foundAvatar: 152 if type(foundAvatar) is dict: 153 for authenticatorName in authenticatorsToUse: 154 if authenticatorName in foundAvatar: 155 foundAvatar = foundAvatar[authenticatorName] 156 break 157 return foundAvatar 148 """ 149 Retrieves the first avatar found using the authenticators in the 150 authenticatorList option (order is respected) 151 """ 152 availableAuths = getVidyoOptionValue("authenticatorList") 153 foundAvatarDict = AuthenticatorMgr().getAvatarByLogin(accountName, availableAuths) 154 155 for authName in availableAuths: 156 foundAvatar = foundAvatarDict.get(authName, None) 157 if foundAvatar: 158 return foundAvatar 158 159 else: 159 160 return None
Note: See TracChangeset
for help on using the changeset viewer.
