def post(self): object_type = self.request.get("object_type") if object_type == "user": if not users.is_current_user_admin(): self.error(400) return fullname = self.request.get('fullname') username = self.request.get('username') email = self.request.get('email') # self.response.out.write(username) # return chk = myusers.MyUser.all().filter("username = ", username).get() if chk: self.error(400) return else: key = myusers.session(self).create_user( fullname, email, username, username) self.response.out.write(str(key)) return if object_type == 'project': if not users.is_current_user_admin(): self.error(400) return project_name = self.request.get('name') key = data.addProject(project_name) self.response.out.write(str(key)) return self.error(400)
def post(self): object_type = self.request.get("object_type") if object_type == "user": key = self.request.get('key') fullname = self.request.get('fullname') email = self.request.get('email') active = (self.request.get('active') == u"да") myusers.updateUser(key, fullname, email, active) self.response.out.write('OK') return if object_type == "project": key = self.request.get('key') name = self.request.get('name') data.updateProject(key, name) self.response.out.write('OK') return if object_type == "password": key = self.request.get('key') passw = self.request.get('pass') if not myusers.session(self).updatePassword(key, passw): self.error(400) return self.response.out.write('OK') return self.error(400)
def get(self): user = myusers.session(self).get_current_user() passw = self.request.get('pass') user.password = passw user.put() self.response.out.write('OK') return
def get(self): user = myusers.session(self).get_current_user() if (not user) and (not users.is_current_user_admin()): self.redirect('/login') else: template_values = { 'projects': data.getProjectsList(user), 'allprojects': data.Project.all(), 'isAdmin': users.is_current_user_admin(), 'users': myusers.myuser.all() } path = os.path.join(os.path.dirname(__file__), 'project.html') self.response.out.write(template.render(path, template_values))
def get(self): user = myusers.session(self).get_current_user() user_pass = self.request.get('pass') db_pass = user.password self.response.out.write(str(user_pass == db_pass)) return