示例#1
0
    def searchemail(self):

        # Search for the owner of the email address
        email = self.request.get("email")
        email = email.lower()

        userEmail = UserEmail.all(keys_only=True).filter("itemValue =", email).get()
        if not userEmail:

            self.sendJsonOK({"found": False})

        else:

            # Check if it's not my own email address
            userProfile = UserProfile.get(userEmail.parent())
            if userProfile.key() == self.userProfile.key():
                raise AjaxError("It is your own email address.")

            # Check if there already is a Psinque from that user
            psinque = self._getPsinqueFrom(userProfile)
            if not psinque is None:
                raise AjaxError("You already have a psinque with this email address.")

            # Check if the account is active
            if not userProfile.active:
                self.sendJsonOK({"found": False})  # act like this person is not registered

            self.sendJsonOK(
                {
                    "found": True,
                    "key": str(userProfile.key()),
                    "displayName": userProfile.displayName,
                    "publicEnabled": userProfile.publicEnabled,
                }
            )
示例#2
0
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")