def addim(self): userIM = UserIM(parent = self.userProfile, itemValue = db.IM(imTypes[self.getRequiredParameter('type')], self.getRequiredParameter('im')), privacyType = self.getRequiredParameter('privacy')) userIM.put() # Add permissions for this email in every outgoing group for persona in self.userProfile.personas: permitIM = PermitIM(parent = persona, userIM = userIM) permitIM.put() self._updateAllVCards() self.sendJsonOK({'key': str(userIM.key())})
def deleteProfile(userProfileKey): userProfile = UserProfile.get(userProfileKey) for e in CardDAVLogin.all().ancestor(userProfile): e.delete() for e in IndividualPermit.all().ancestor(userProfile): e.delete() for e in Persona.all().ancestor(userProfile): e.delete() for e in Psinque.all().ancestor(userProfile): e.delete() for e in Contact.all().ancestor(userProfile): e.delete() for e in Group.all().ancestor(userProfile): e.delete() for e in UserAddress.all().ancestor(userProfile): e.delete() for e in UserEmail.all().ancestor(userProfile): e.delete() for e in UserIM.all().ancestor(userProfile): e.delete() for e in UserPhoneNumber.all().ancestor(userProfile): e.delete() for e in UserPhoto.all().ancestor(userProfile): e.image.delete() e.delete() for e in UserNickname.all().ancestor(userProfile): e.delete() for e in UserCompany.all().ancestor(userProfile): e.delete() for e in UserWebpage.all().ancestor(userProfile): e.delete() if not userProfile.userSettings is None: userProfile.userSettings.delete() userProfile.delete() logging.info("User profile deleted")