Exemplo n.º 1
0
    def execute(self):
        currentUser = self.loginUser
        if currentUser == None:
            response.getWriter().write(u"请先登录。")
            return

        fc = FileCache()
        fc.deleteUserAllCache(currentUser.loginName)
        fc = None
        response.getWriter().write(u"清空完毕。")
Exemplo n.º 2
0
    def list(self):
        # print "list is executed, loginUesr = ", self.loginUser
        if self.loginUser == None:
            return "/WEB-INF/ftl/placard/placard_list.ftl"
        qry = PlacardQuery(""" pld.id, pld.title, pld.createDate, pld.hide """)
        qry.objType = ObjectType.OBJECT_TYPE_USER.typeId
        qry.objId = self.loginUser.userId
        qry.hideState = None
        placard_list = qry.query_map(10)
        request.setAttribute("placard_list", placard_list)

        fc = FileCache()
        fc.deleteUserAllCache(self.loginUser.loginName)
        fc = None
        return "/WEB-INF/ftl/placard/placard_list.ftl"
Exemplo n.º 3
0
 def save(self):
   # 从参数中组装出用户对象.
   user = self.collectUserInfo()
   if user == None:
     return self.ERROR
   
   userUnitId = self.params.getIntParamZeroAsNull("unitId")
   if userUnitId == None:
     self.addActionError(u"用户机构必须填写。")
     return self.ERROR
   if userUnitId != user.unitId:
     # 修改个机构字段人信息
     userUnit = self.unitService.getUnitById(userUnitId)
     if userUnit == None:
       self.addActionError(u"你选择的机构不存在。")
       return self.ERROR
     
     user.setUnitId(userUnitId)
     user.setUnitPathInfo(userUnit.unitPathInfo)
  
   # 判断权限.
   if not self.can_edit_user(user):
     return self.ERROR
   
   # 保存修改.
   try:
     self.userService.updateUser(user)
   except:
     exc_type, exc_value, exc_tb = sys.exc_info()
     self.addActionError(u"错误信息:%s" % exc_value)
     return self.ERROR
     
   # 设置显示信息.
   self.addActionMessage(u"用户 %s 的信息修改完成." % user.toDisplayString())
   
   __referer = self.params.getStringParam("__referer")
   if __referer != "":
     self.addActionLink(u"返回", self.params.getStringParam("__referer"))
   else:
     self.addActionLink(u"返回", "?cmd=list")
   cache = __jitar__.cacheProvider.getCache('user')
   cache.clear()
   fc = FileCache()
   fc.deleteUserAllCache(user.loginName)
   fc = None
   return self.SUCCESS
Exemplo n.º 4
0
 def deleteUserCache(self, user):
     fc = FileCache()
     fc.deleteUserAllCache(user.loginName)
     fc = None