Esempio n. 1
0
    def commdelete(self):
        inputParams = self.getInput()
        groupcomm = GroupComments.get(GroupComments.id == int(inputParams['id']))

        current_user = Users.get(Users.name == self.isLogin())
        if current_user.id != groupcomm.owner.id and not self.isAdmin() or not current_user.role.type < 100:
            return self.error(msg = '权限不足!', url=self.makeUrl('/admin/groups/comments'))

        try:
            groupcomm.delete_instance()
        except Exception, e:
            return self.success(msg='公司评论删除失败: %s' % e, url=self.makeUrl('/admin/groups/comments'))
Esempio n. 2
0
    def commupdate(self):
        inputParams= self.getInput()
        groupcomm = GroupComments.get(GroupComments.id == int(inputParams['id']))

        current_user = Users.get(Users.name == self.isLogin())
        if current_user.id != groupcomm.owner.id and not self.isAdmin() or  not current_user.role.type < 100:
            return self.error(msg = '权限不足!', url=self.makeUrl('/admin/groups/list'))

        try:
            groupcomm.content = inputParams['content']
            ##现在时间没有更新,需要更新时间为当前时间
            groupcomm.save()
        except Exception, e:
            return self.error(msg = '公司评论修改失败: %s' % e, url=self.makeUrl('/admin/groups/comments'))