<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="java.lang.reflect.Method" %>
<%!

    /**
     * 如果获取到的标签为null 或者 空字符串 返回空
     * @param labelid
     * @param languageid
     * @return
     */
    public static String getUpgradeHtmlLabelName(int labelid,int languageid){
        String labelname=weaver.systeminfo.SystemEnv.getHtmlLabelName(labelid,languageid);
        if(labelname==null){
        }else{
            if(labelname.trim().equals("") || labelname.trim().contains("null") || labelname.trim().contains("NULL")){
                labelname=null;
            }
        }
        return labelname;
    }

    /**
     * 获取二级目录
     * @return
     */
    public static String getSecondDirectoryName(){
        String secondarydirnames="";
        try{
            Class class1 = Class.forName("weaver.system.SystemUpgradeUtil");
            if(class1!=null) {
                Method getSecondDirectoryName = class1.getMethod("getSecondDirectoryName");
                if(getSecondDirectoryName!=null){
                   String result=(String)getSecondDirectoryName.invoke(null);
                   if(result!=null){
                       secondarydirnames=result.trim();
                   }
                }
            }
        }catch(Throwable e){
            //e.printStackTrace();
        }
        return secondarydirnames;
    }
%>
<%
    User myuser = HrmUserVarify.getUser(request, response);
    if(myuser == null) {
        return;
    }

    try{
        Class class1 = Class.forName("com.weaver.function.ConfigInfo");
        if(class1!=null) {
            Object configInfo = class1.newInstance();
            Method checkIsUpdateUser = class1.getMethod("checkIsUpdateUser", int.class);
            if (checkIsUpdateUser != null) {
                Boolean isUpdateUser = (Boolean) checkIsUpdateUser.invoke(configInfo, myuser.getUID());//获取安全补丁版本
                if (!isUpdateUser.booleanValue()) {
                    response.sendRedirect(getSecondDirectoryName()+"/notice/noright.jsp");
                    return;
                }
            } else {
                //默认是sysadmin
                if (myuser.getUID() != 1) {
                    new BaseBean().writeLog("非法访问:非管理员访问,user_id="+myuser.getUID());
                    return;
                }
            }
        }
    }catch(Throwable e){
        //默认是sysadmin
        if (myuser.getUID() != 1) {
            new BaseBean().writeLog("非法访问:非管理员访问,user_id="+myuser.getUID());
            return;
        }
    }
%>