Ejemplo n.º 1
0
 def get(self):
     #check that we're coming from an LL ip
     if lindenip.inrange(os.environ['REMOTE_ADDR']) != 'Production':
         self.error(403)
     elif self.request.headers['X-SecondLife-Shard'] != 'Production':
         logging.warning("Attempt while on beta grid %s" % (self.request.headers['X-SecondLife-Shard']))
         self.response.set_status(305)
     else:
         av = self.request.headers['X-SecondLife-Owner-Key']
         avname = self.request.headers['X-SecondLife-Owner-Name']
         if avname != "(Loading...)":
             relations.update_av(av, avname)            
         #get all relations for which av is owner or secowner
         subdict = {}
         ownersubs = relations.getby_subj_type(av, 'owns')
         for sub in ownersubs:
             id = sub.obj_id
             if id not in subdict:
                 subdict[id] = relations.key2name(id)
             else:
                 #delete duplicates
                 sub.delete()
             
         secownersubs = relations.getby_subj_type(av, 'secowns')
         for sub in secownersubs:
             id = sub.obj_id
             if id not in subdict:#since you can be both an owner and a secowner, ignore those here already in the owner list
                 subdict[id] = relations.key2name(id)
                 
         out = ''
         for sub in subdict:
             out += '%s,%s,' % (sub, subdict[sub])
         self.response.out.write(out.rstrip(','))
Ejemplo n.º 2
0
 def get(self):
     user = users.get_current_user()
     userid = user.user_id()
     q1 = GoogleSLIds.all().filter("google_id =", userid)
     q2 = GoogleSLIds.all().filter("google_id =", userid)
     q3 = GoogleSLIds.all().filter("google_id =", userid)
     if q1.count() == 0:
         message = '''
 You do not have any SL names linked to this acount. Enter a SL username to be verified. You will get an IM to complte the verifcation.
 <br />
 '''+form
         self.response.out.write(head+message+end)#promt to add name to list
     else:
         q1.filter("verifed =", True)
         if not q1.count() == 0:
             message = "Verifed names:<br />"
             for x in q1:
                 message += x.sl_name+"<br />"
                 av = x.sl_key
                 subdictown = {}
                 subdictsecown = {}
                 ownersubs = relations.getby_subj_type(av, 'owns')
                 for sub in ownersubs:
                     id = sub.obj_id
                     if id not in subdictown:
                         subdictown[id] = relations.key2name(id)
                     else:
                         #delete duplicates
                         sub.delete()
                     
                 secownersubs = relations.getby_subj_type(av, 'secowns')
                 for sub in secownersubs:
                     id = sub.obj_id
                     if id not in (subdictown or subdictsecown):#since you can be both an owner and a secowner, ignore those here already in the owner list
                         subdictsecown[id] = relations.key2name(id)
                         
                 out = ''
                 for sub in subdictown:
                     out += '<a href="/map/?key=%s">%s</a> own <br />' % (sub, subdictown[sub])
                 for sub in subdictsecown:
                     out += '<a href="/map/?key=%s">%s</a> secown <br />' % (sub, subdictsecown[sub])
                 message += out
             q2.filter("verifed =", False)
             if not q2.count() == 0:
                 message += "You have the following names waiting to be verifed: <br />"
                 for x in q2:
                     message += x.sl_name+"<br />"
             message += form
             #at least one acount verifed
             self.response.out.write(head+message+end)
         else:
             message = "You have the following names waiting to be verifed: <br />"
             results = q2.fetch(10) 
             for x in results:
                 message += x.sl_name+"<br />"
             message += form
             self.response.out.write(head+message+end)#show the acocounts not verifed and promt or more
Ejemplo n.º 3
0
    def get(self):
        # check that we're coming from an LL ip
        if not lindenip.inrange(os.environ["REMOTE_ADDR"]):
            self.error(403)
        else:
            av = self.request.headers["X-SecondLife-Owner-Key"]
            avname = self.request.headers["X-SecondLife-Owner-Name"]
            if avname != "(Loading...)":
                relations.update_av(av, avname)
            # get all relations for which av is owner or secowner
            subdict = {}
            suburldict = {}
            ownersubs = relations.getby_subj_type(av, "owns")
            for sub in ownersubs:
                id = sub.obj_id
                if id not in subdict:
                    subdict[id] = relations.key2name(id)
                    q = Lookup.get_by_key_name("URL:" + id)
                    if q is None:
                        suburldict[id] = "None"
                    else:
                        suburldict[id] = q.ownurl
                else:
                    # delete duplicates
                    sub.delete()

            secownersubs = relations.getby_subj_type(av, "secowns")
            for sub in secownersubs:
                id = sub.obj_id
                if (
                    id not in subdict
                ):  # since you can be both an owner and a secowner, ignore those here already in the owner list
                    subdict[id] = relations.key2name(id)
                    q = Lookup.get_by_key_name("URL:" + id)
                    if q is None:
                        suburldict[id] = "None"
                    else:
                        suburldict[id] = q.securl
            currenttime = time.time()
            out = ""
            subsorted = sorted(subdict.items(), key=itemgetter(1))
            for sub in subsorted:
                #                out += '%s,%s,%s,%s,' % (sub[0], sub[1], suburldict[sub[0]], currenttime)
                # fix for sub restriction we dont send actual urls but only send them on demand
                out += "%s,%s,%s,%s," % (sub[0], sub[1], "None", 0)
            memcache.set("Subs:" + av, out)
            self.response.out.write(out.rstrip(","))
Ejemplo n.º 4
0
    def get(self):
        #check that we're coming from an LL ip
        if not lindenip.inrange(os.environ['REMOTE_ADDR']):
            self.error(403)
        else:
            av = self.request.headers['X-SecondLife-Owner-Key']
            avname = self.request.headers['X-SecondLife-Owner-Name']
            if avname != "(Loading...)":
                relations.update_av(av, avname)
            #get all relations for which av is owner or secowner
            subdict = {}
            suburldict = {}
            ownersubs = relations.getby_subj_type(av, 'owns')
            for sub in ownersubs:
                id = sub.obj_id
                if id not in subdict:
                    subdict[id] = relations.key2name(id)
                    q = Lookup.get_by_key_name("URL:"+id)
                    if q is None :
                        suburldict[id] = 'None'
                    else:
                        suburldict[id] = q.ownurl
                else:
                    #delete duplicates
                    sub.delete()

            secownersubs = relations.getby_subj_type(av, 'secowns')
            for sub in secownersubs:
                id = sub.obj_id
                if id not in subdict:#since you can be both an owner and a secowner, ignore those here already in the owner list
                    subdict[id] = relations.key2name(id)
                    q = Lookup.get_by_key_name("URL:"+id)
                    if q is None :
                        suburldict[id] = 'None'
                    else:
                        suburldict[id] = q.securl
            currenttime = time.time()
            out = ''
            subsorted = sorted(subdict.items(), key=itemgetter(1))
            for sub in subsorted:
#                out += '%s,%s,%s,%s,' % (sub[0], sub[1], suburldict[sub[0]], currenttime)
# fix for sub restriction we dont send actual urls but only send them on demand
                out += '%s,%s,%s,%s,' % (sub[0], sub[1], "None", 0)
            memcache.set("Subs:"+av, out)
            self.response.out.write(out.rstrip(','))
Ejemplo n.º 5
0
 def get(self):
     if (self.request.headers['sharedpass'] == sharedpass):
         key = cgi.escape(self.request.get('key'))
         logging.info('Key2name request for %s' % (key))
         name = relations.key2name(key)
         if name:
             logging.info('Resolved as %s' % (name))
             self.response.out.write(name)
             self.response.set_status(200)#accepted
         else:
             logging.warning('Could not be resolved! Sending request now to inworld item.')
             RequestName(key)
             self.response.out.write('')
             self.response.set_status(202)#accepted
     else:
         self.error(403)
         logging.error('wrong shared password expecting %s received %s ip address' % (sharedpass,self.request.headers['sharedpass'],os.environ['REMOTE_ADDR']))
Ejemplo n.º 6
0
 def get(self):
     if (self.request.headers['sharedpass'] == sharedpass):
         key = cgi.escape(self.request.get('key'))
         logging.info('Key2name request for %s' % (key))
         name = relations.key2name(key)
         if name:
             logging.info('Resolved as %s' % (name))
             self.response.out.write(name)
             self.response.set_status(200)  #accepted
         else:
             logging.warning(
                 'Could not be resolved! Sending request now to inworld item.'
             )
             RequestName(key)
             self.response.out.write('')
             self.response.set_status(202)  #accepted
     else:
         self.error(403)
         logging.error(
             'wrong shared password expecting %s received %s ip address' %
             (sharedpass, self.request.headers['sharedpass'],
              os.environ['REMOTE_ADDR']))
Ejemplo n.º 7
0
def format_article(article):    
    return "%s\n%s\n%s\n\n%s" % (article.title, relations.key2name(article.author), str(article.dts), article.text)
Ejemplo n.º 8
0
def getownerlist(userid):
    ownerlist = memcache.get(userid + "ownerlist")
    if ownerlist is not None:
        sublist = memcache.get(userid + "subs").keys()
        checksubs = memcache.get_multi(sublist)
        for sub in checksubs:
            if checksubs[sub] is not None:
                memcache.delete_multi(sublist)
                ownerlist = getownerlist(userid)
                break
        return ownerlist
    else:
        q1 = GoogleSLIds.all().filter("google_id =", userid)
        q2 = GoogleSLIds.all().filter("google_id =", userid)
        q3 = GoogleSLIds.all().filter("google_id =", userid)
        if not q1.count() == 0:
            q1.filter("verifed =", True)
            if not q1.count() == 0:
                ownerlist = 'Verifed names:<br /><table border="1">'
                subdict = {}
                subdictown = {}
                subdictsecown = {}
                for x in q1:
                    ownerlist += '<tr><td colspan="2">' + x.sl_name + "</td></tr>"
                    av = x.sl_key
                    subdictownloc = {}
                    subdictsecownloc = {}
                    ownersubs = relations.getby_subj_type(av, 'owns')
                    for sub in ownersubs:
                        id = sub.obj_id
                        if id not in subdictownloc:
                            subdictownloc[id] = relations.key2name(id)
                        else:
                            #delete duplicates
                            sub.delete()

                    secownersubs = relations.getby_subj_type(av, 'secowns')
                    for sub in secownersubs:
                        id = sub.obj_id
                        if id not in (
                                subdictownloc or subdictsecownloc
                        ):  #since you can be both an owner and a secowner, ignore those here already in the owner list
                            subdictsecownloc[id] = relations.key2name(id)

                    out = ''
                    subdictown.update(subdictownloc)
                    subdictsecown.update(subdictsecownloc)
                    subsortedown = sorted(subdictownloc.items(),
                                          key=itemgetter(1))
                    subsortedsecown = sorted(subdictsecownloc.items(),
                                             key=itemgetter(1))
                    for sub in subsortedown:
                        out += '<tr><td><a href="/map/?key=%s">%s</a></td><td>Owner</td></tr>' % (
                            sub[0], sub[1])
                    for sub in subsortedsecown:
                        out += '<tr><td><a href="/map/?key=%s">%s</a></td><td>Sec. Owner</td></tr>' % (
                            sub[0], sub[1])
                    ownerlist += out
                ownerlist += '</table>'
                q2.filter("verifed =", False)
                if not q2.count() == 0:
                    ownerlist += "You have the following names waiting to be verifed: <br />"
                    for x in q2:
                        ownerlist += x.sl_name + "<br />"
                ownerlist += form
                subdict.update(subdictown)
                subdict.update(subdictsecown)
                memcache.set(userid + "ownerlist", ownerlist, 600)
                memcache.set(userid + "subs", subdict, 600)
                memcache.set(userid + "ownsubs", subdictown, 600)
                memcache.set(userid + "secownsubs", subdictsecown, 600)
                return ownerlist
            else:
                logging.warning(
                    '%s is trying to get %s page but does not have any verified users'
                    % (useremail, param2))
                return "error"
        else:
            logging.warning(
                '%s is trying to get %s page but does not have any verified or unvierified users'
                % (useremail, param2))
            return "error"
Ejemplo n.º 9
0
def getownerlist(userid):
    ownerlist = memcache.get(userid+"ownerlist")
    if ownerlist is not None:
        sublist = memcache.get(userid+"subs").keys()
        checksubs = memcache.get_multi(sublist)
        for sub in checksubs:
            if checksubs[sub] is not None:
                memcache.delete_multi(sublist)
                ownerlist = getownerlist(userid)
                break
        return ownerlist
    else:
        q1 = GoogleSLIds.all().filter("google_id =", userid)
        q2 = GoogleSLIds.all().filter("google_id =", userid)
        q3 = GoogleSLIds.all().filter("google_id =", userid)
        if not q1.count() == 0:
              q1.filter("verifed =", True)
              if not q1.count() == 0:
                  ownerlist = 'Verifed names:<br /><table border="1">'
                  subdict = {}
                  subdictown = {}
                  subdictsecown = {}
                  for x in q1:
                      ownerlist += '<tr><td colspan="2">'+x.sl_name+"</td></tr>"
                      av = x.sl_key
                      subdictownloc = {}
                      subdictsecownloc = {}
                      ownersubs = relations.getby_subj_type(av, 'owns')
                      for sub in ownersubs:
                          id = sub.obj_id
                          if id not in subdictownloc:
                              subdictownloc[id] = relations.key2name(id)
                          else:
                              #delete duplicates
                              sub.delete()
                          
                      secownersubs = relations.getby_subj_type(av, 'secowns')
                      for sub in secownersubs:
                          id = sub.obj_id
                          if id not in (subdictownloc or subdictsecownloc):#since you can be both an owner and a secowner, ignore those here already in the owner list
                              subdictsecownloc[id] = relations.key2name(id)
                              
                      out = ''
                      subdictown.update(subdictownloc)
                      subdictsecown.update(subdictsecownloc)
                      subsortedown = sorted(subdictownloc.items(), key=itemgetter(1))
                      subsortedsecown = sorted(subdictsecownloc.items(), key=itemgetter(1)) 
                      for sub in subsortedown:
                          out += '<tr><td><a href="/map/?key=%s">%s</a></td><td>Owner</td></tr>' % (sub[0], sub[1])
                      for sub in subsortedsecown:
                          out += '<tr><td><a href="/map/?key=%s">%s</a></td><td>Sec. Owner</td></tr>' % (sub[0], sub[1])
                      ownerlist += out
                  ownerlist +='</table>'
                  q2.filter("verifed =", False)
                  if not q2.count() == 0:
                      ownerlist += "You have the following names waiting to be verifed: <br />"
                      for x in q2:
                          ownerlist += x.sl_name+"<br />"
                  ownerlist += form
                  subdict.update(subdictown)
                  subdict.update(subdictsecown)
                  memcache.set(userid+"ownerlist", ownerlist, 600)
                  memcache.set(userid+"subs", subdict, 600)
                  memcache.set(userid+"ownsubs", subdictown, 600)
                  memcache.set(userid+"secownsubs", subdictsecown, 600)
                  return ownerlist
              else:
                  logging.warning('%s is trying to get %s page but does not have any verified users' % (useremail, param2))
                  return "error"
        else:
            logging.warning('%s is trying to get %s page but does not have any verified or unvierified users' % (useremail, param2))
            return "error"