Пример #1
0
 def post(self):
     #if person logged in is a project head, removes a user from a project 
     #check login status
     pjc = login.getProjectMember()
     if pjc is None:
         self.error(500)
         return
     
     project_id = self.request.get("p", default_value=None)
     if project is None:
         logging.error("pj_id_invalid %s" % project_id)
         self.error(500)
         return
         
     project = Project.get_by_id(int(project_id))
     if project is None:
         logging.error("pj_notfound %s" % project_id)
         self.error(500)
         return    
         
     if project.creator is not pjc:
         self.error(500)
         return    
         
     rem_user_id = self.request.get("u", default_value=None)
     if rem_user_id is None:
         logging.error("remu_id_invalid %s" % rem_user_id)
         self.error(500)
         return
         
     rem_user = ProjectMember.get_by_id(int(rem_user_id))
     if rem_user is None:
         logging.error("remu_notfound %s" % rem_user_id)
         self.error(500)
         return    
         
     project_handler.setProjectListNeedsUpdateForUser(rem_user_id)
     project_handler.projectJustUpdated(project)
     
     for i in xrange(len(project.users)):
         if project.users[i] == rem_user_id:
             del project.users[i]
             project.put()
             self.request.out.write('1')
             return
             
     self.request.out.write('0')
Пример #2
0
 def get(self):
     #checks an invite hash, asks them to login if not, then creates projectmember
     #finally redirects to the project page
     
     #check login status
     project_member = login.getProjectMember(deny_access=False)
     if project_member is None:
         self.redirect(login.getLoginScreen(self.request.uri))
         return
         
         
     project_handler.setProjectListNeedsUpdateForUser(project_member.key().id())
     project_handler.projectJustUpdated(project)
 
     success = login.checkInvite(project_member)
     if not success:
         self.response.headers['Content-Type'] = 'text/plain-text'
         self.response.out.write("""Invite was invalid or expired after 7 days.\n 
                                    Please get a new invite.""")
     else:
         self.redirect("/project?p=%s" % success.invited_to.key().id())