问题解决

首页问题解决
11
Aug
0

安装uwsgi出错

错误1:
centos 6.5
python 3.6
core/routing.o: In function `uwsgi_route_condition_regexp':

routing.c:(.text+0x365c): undefined reference to `pcre_free_study'
routing.c:(.text+0x3680): undefined reference to `pcre_free_study'
collect2: ld 返回 1
*** error linking uWSGI ***

解决方法:
需要先御载pcre-devel

yum remove pcre-devel
pip3 install uwsgi 
06
Jun
0

django rest framework action里post引起的403错误

错误信息为:
CSRF Failed: CSRF cookie not set

代码 403

原因:
django rest framework里的验证哪怕是在django里关闭掉django.middleware.csrf.CsrfViewMiddleware

也会在验证时去验证csrf.

源文件位置:
rest framework目录authentication.py
130行调用了csrf
self.enforce_csrf(request)

深入发现reason = CSRFCheck().process_view(request, None, (), {})
再进入发现是继承过来的
class CSRFCheck(CsrfViewMiddleware):
到这里又回到了django里了
也就是说要在rest framework里禁用,就只能注释掉那行代码

不管它继续往里找
发现CsrfViewMiddleware中间件里有这么一行

def process_view(self, request, callback, callback_args, callback_kwargs):
    if getattr(request, 'csrf_processing_done', False):
        return None
    if request.method not in ('GET', 'HEAD', 'OPTIONS', 'TRACE'):
        if getattr(request, '_dont_enforce_csrf_checks', False):

也就是说 设置request的 _dont_enforce_csrf_checks为True就可以通过检查
整个问题解决完成

17
May
0

java.security.InvalidKeyException: Illegal key size错误解决方法

一段正常的能在服务器上跑的企业号代码
到本地直接报AES解码失败
一脸蒙圈 唯一的理由就是本地环境问题

从错误信息看就KEY太大引起的,密钥长度受限了
度娘一下 原因是不能超过128位

然后只能替换掉本地JCE无限制权限文件
地址{java_home}/jre/lib/security

替换文件
JDK1.7的下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
JDK1.8的下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

27
Apr
0

火狐浏览器(量子版本)无法登陆帐号

原因:
中国版本区分了,全球服务和本地服务两套服务,并且不通用造成的.
而且只有中国版有两套服务.

状况:
输入帐号密码后,一直停留在处理中....

解决:
检查附加组件里,是否有[附加组件管理器]这个组件,并且是启用的.
如果没有则下载安装 地址:http://mozilla.com.cn/thread-343905-1-1.html
最新默认版,已经内置[附加组件管理器]

然后在火狐通行证页面下方可以随意切换全球服务或中国服务

22
Mar
0

jira绕过认证系统登陆和部分表说明

最近需要对jira进行公司内部sso集成,经多方了解,最后写插件才解决问题

主要流程是先下载安装plugin sdk包然后按照
https://developer.atlassian.com/server/framework/atlassian-sdk/create-a-helloworld-plugin-project/
页面的步骤操作,过程有点慢,因为这里创建基础框架的时候会下载一大堆的相关东西
命令有:
atlas-create-jira-plugin 创建基础框架
atlas-run 执行插件
默认帐号密码都为admin

然后在位置/src/main/java/com.atlassian.tutorial/目录创建
SSOFilter.java文件

package com.atlassian.tutorial;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.security.Principal;

public class SSOFilter implements Filter {
    public SSOFilter() {
    }
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //TODO GEELY-UC-SSO-SDK
        //TODO 调用SSO认证服务,根据TOKEN获取用户标示(域账号)
        //TODO 调用JIRA认证接口,构建回话
        //TODO SESSION KEY: ASESSIONID
        simuldateLogin((HttpServletRequest)servletRequest);
        filterChain.doFilter(servletRequest, servletResponse);
    }
    protected void simuldateLogin(HttpServletRequest request) {
            Principal principal = new Principal() {
                @Override
                public String getName() {
                    return "admin";
                }
            };
            request.getSession().setAttribute("seraph_defaultauthenticator_user", principal);
            request.getSession().setAttribute("seraph_defaultauthenticator_logged_out_user", (Object)null);
    }
    @Override
    public void destroy() {
    }
}

返回什么名称 就直接登陆jira系统里有的用户
然后找到/src/main/resources/atlassian-plugin.xml文件修改节点

  <servlet-filter name="Hello World Servlet" key="helloWorld" class="com.atlassian.tutorial.SSOFilter" location="after-encoding" weight="200">
    <description>Says Hello World, Australia or your name.</description>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </servlet-filter>

location 设置插件执行时机
weight 同类插件中的权重

表说明,就不说明了,直接上sql语句慢慢理解吧 哈哈
-- 根据PKEY取到issue
select jiraissue.* from jiraissue
INNER JOIN project_key on (jiraissue.project = project_key.project_id and project_key = 'SDLC')
where issuenum = 1284

-- 根据KR主任务关联ISSUE 单层
select jiraissue.* from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))

-- 根据KR主任务关联ISSUE 第三层
select jiraissue.* from jiraissue
where id in(
select destination from issuelink where source = 163121 and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link'))

-- 根据KR主任务关联ISSUE 三层
select distinct t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) priority,
assignee as executor,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间 from (
select jiraissue.* from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.* from jiraissue
where id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1

-- 统计数量
select distinct t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) priority,
assignee as executor,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间 from (
select jiraissue.* from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.* from jiraissue
where id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1

-- 所有数量
select count(*) from (
select jiraissue.* from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.* from jiraissue
where id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1

-- 未结束数量
select count(*) as f_count from(
select distinct t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) priority,
assignee as executor,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间 from (
select jiraissue.* from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.* from jiraissue
where id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1) as t10 where 实际完成时间 is NULL

-- 延期数量
select * from(
select distinct t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) priority,
assignee as executor,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间 from (
select jiraissue.* from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.* from jiraissue
where id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1) as t10 where str_to_date(CONCAT(DATE_FORMAT(计划到期日, '%Y-%m-%d'),'23:59:59'), '%Y-%m-%d %T') < 实际完成时间

-- 已结束数量
select count(*) as f_count from(
select distinct t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) priority,
assignee as executor,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间 from (
select jiraissue.* from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.* from jiraissue
where id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1) as t10 where 实际完成时间 is not NULL

-- 已结束数据
select jiraId,title,content,priority,executor,实际开始时间 as startdate,实际完成时间 as enddate,state,jirapkey as detailurl from(
select t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) as priority,
assignee as executor,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,jirapkey from (
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
left join project on (project.id = jiraissue.project)
where jiraissue.id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
inner join project on (project.id = jiraissue.project)
where jiraissue.id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1
) as t10 where 实际完成时间 is not NULL

-- 未结束数据
select jiraId,title,content,priority,executor,实际开始时间 as startdate,实际完成时间 as enddate,state,jirapkey as detailurl from(
select t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) as priority,
assignee as executor,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,jirapkey from (
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
left join project on (project.id = jiraissue.project)
where jiraissue.id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
inner join project on (project.id = jiraissue.project)
where jiraissue.id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1
) as t10 where 实际完成时间 is NULL

-- 延期数据
select jiraId,title,content,priority,executor,实际开始时间 as startdate,实际完成时间 as enddate,state,jirapkey as detailurl from(
select t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) as priority,
assignee as executor,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,jirapkey from (
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
left join project on (project.id = jiraissue.project)
where jiraissue.id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
inner join project on (project.id = jiraissue.project)
where jiraissue.id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1
) as t10 where str_to_date(CONCAT(DATE_FORMAT(计划到期日, '%Y-%m-%d'),'23:59:59'), '%Y-%m-%d %T') < 实际完成时间

-- 所有数据
select jiraId,title,content,priority,executor,实际开始时间 as startdate,实际完成时间 as enddate,state,jirapkey as detailurl from(
select t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) as priority,
assignee as executor,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,jirapkey from (
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
left join project on (project.id = jiraissue.project)
where jiraissue.id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
inner join project on (project.id = jiraissue.project)
where jiraissue.id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination = 149214 and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1
) as t10

-- 根据用户查询所有数据
select jiraId,title,content,priority,executor,实际开始时间 as startdate,实际完成时间 as enddate,state,jirapkey as detailurl from(
select t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) as priority,
assignee as executor,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,jirapkey from (
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
left join project on (project.id = jiraissue.project)
where jiraissue.id in(
select source from issuelink where destination in(select id from jiraissue where project = 10404 and issuetype = 11500) and linktype in (select id from issuelinktype where linkname = 'Blocks'))
union
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
inner join project on (project.id = jiraissue.project)
where jiraissue.id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination in(select id from jiraissue where project = 10404 and issuetype = 11500) and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link')))as t1
) as t10 where t10.executor = 'huang.xiaogang'

-- 根据用户查询未结束数据
select jiraId,title,content,priority,executor,实际开始时间 as startdate,实际完成时间 as enddate,state,jirapkey as detailurl from(
select t1.id as jiraId,summary as title,description as content,(select pname from priority where priority.id = t1.priority) as priority,
assignee as executor,
(select datevalue from customfieldvalue where customfieldvalue.issue = t1.id and customfieldvalue.customfield in(select id from customfield where cfname like '计划开始时间')) as 计划开始时间,
duedate as 计划到期日,
(select changegroup.created from changeitem , changegroup where changegroup.issueid = t1.id and changeitem.oldvalue = 10000 and changegroup.id = changeitem.groupid limit 1) as 实际开始时间,
resolutiondate as 实际完成时间,(select pname from issuestatus where issuestatus.id = t1.issuestatus) as state,jirapkey from (
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
left join project on (project.id = jiraissue.project)
where jiraissue.id in(
select source from issuelink where destination in(select id from jiraissue where project = 10404 and issuetype = 11500 and issuestatus not in (select id from issuestatus where pname = 'Closed')) and linktype in (select id from issuelinktype where linkname = 'Blocks'))
and issuestatus not in (select id from issuestatus where pname = 'Closed')
union
select jiraissue.*,concat(project.pkey,'-',jiraissue.issuenum) as jirapkey from jiraissue
inner join project on (project.id = jiraissue.project)
where jiraissue.id in(
select destination from issuelink where source in (select jiraissue.id from jiraissue
where id in(
select source from issuelink where destination in(select id from jiraissue where project = 10404 and issuetype = 11500 and issuestatus not in (select id from issuestatus where pname = 'Closed')) and linktype in (select id from issuelinktype where linkname = 'Blocks'))
) and linktype in (select id from issuelinktype where linkname = 'jira_subtask_link'))
and issuestatus not in (select id from issuestatus where pname = 'Closed')
)as t1
) as t10 where t10.executor = 'huang.xiaogang' and 实际完成时间 is null