Beispiel #1
0
def createNewGroup(userProfile, groupName):

    group = Group(parent = userProfile,
                  name = groupName)
    group.put()
    logging.info("New group created, key = " + str(group.key()))

    return group.key()
Beispiel #2
0
    def changegroup(self):

        try:
            contact = Contact.get(self.getRequiredParameter("contact"))
        except datastore_errors.BadKeyError:
            raise AjaxError("Contact does not exist")

        # oldGroup = contact.group

        try:
            persona = Group.get(self.getRequiredParameter("persona"))
        except datastore_errors.BadKeyError:
            raise AjaxError("Group does not exist")

        # First we check if this psinque is not already asigned to that group
        contact.group = group
        contact.put()

        # oldGroupSize = Contact.all(keys_only = True). \
        # filter("group =", oldGroup). \
        # count(1)
        # if oldGroupSize == 0:
        # olfGroup.delete()

        self.sendJsonOK()
Beispiel #3
0
def groupList(userProfile):
    """Returns the list of all groups created by the logged in user.

    :returns: list -- the list of groups

    """
    groupNames = []
    for group in Group.all().ancestor(userProfile):
        if group.sync:
            groupNames.append(group.name)       
    return groupNames
Beispiel #4
0
def friendList(userProfile, groupName):
    
    friendList = []

    group = Group.all(). \
                  ancestor(userProfile). \
                  filter("name =", groupName). \
                  get()
    
    contacts = Contact.all(). \
                       ancestor(userProfile). \
                       filter("group =", group)
    
    for contact in contacts:
        friendList.append(str(contact.key()) + ".vcf")
        
    return friendList
Beispiel #5
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")
Beispiel #6
0
    def addgroup(self):

        group = Group(parent=self.userProfile, name=self.getRequiredParameter("name"))
        group.put()

        self.sendJsonOK({"key": str(group.key())})