Commit 0381e387 authored by zhang.xin's avatar zhang.xin
Browse files

完成用户管理功能

parent 2dff6362
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
package com.ai.cloud.skywalking.web.bo;

import com.ai.cloud.skywalking.web.entity.AlarmRule;

public class AlarmRuleInfo {
    private AlarmRule selfAlarmRule;
    private AlarmRule globalAlarmRule;
    private boolean hasGlobalAlarm;
    private boolean isGlobalAlarm;

    public AlarmRuleInfo(AlarmRule selfAlarmRule, AlarmRule globalAlarmRule) {
        this.selfAlarmRule = selfAlarmRule;
        this.globalAlarmRule = globalAlarmRule;

        if (selfAlarmRule == null) {
            isGlobalAlarm = true;
        }

        if (globalAlarmRule != null) {
            hasGlobalAlarm = true;
        }
    }
}
+31 −0
Original line number Diff line number Diff line
package com.ai.cloud.skywalking.web.bo;

import com.ai.cloud.skywalking.web.entity.Application;

public class ApplicationInfo extends Application {

    public ApplicationInfo(String applicationId) {
        super(applicationId);
    }

    private boolean hasGlobalAlarmRule;
    private boolean isGlobalAlarmRule;
    private boolean isUpdateGlobalConfig;
    private boolean isGlobalConfig;

    public boolean isGlobalConfig() {
        return isGlobalConfig;
    }

    public boolean isUpdateGlobalConfig() {
        return isUpdateGlobalConfig;
    }

    public void setHasGlobalAlarmRule(boolean hasGlobalAlarmRule) {
        this.hasGlobalAlarmRule = hasGlobalAlarmRule;
    }

    public void setGlobalAlarmRule(boolean globalAlarmRule) {
        isGlobalAlarmRule = globalAlarmRule;
    }
}
+9 −0
Original line number Diff line number Diff line
package com.ai.cloud.skywalking.web.bo;

import com.ai.cloud.skywalking.web.entity.UserInfo;

/**
 * Created by xin on 16-3-21.
 */
public class LoginUserInfo extends UserInfo {
}
+9 −0
Original line number Diff line number Diff line
package com.ai.cloud.skywalking.web.bo;

import com.ai.cloud.skywalking.web.entity.UserInfo;

/**
 * Created by xin on 16-3-25.
 */
public class SignInUserInfo extends UserInfo {
}
+23 −0
Original line number Diff line number Diff line
package com.ai.cloud.skywalking.web.common;

import com.ai.cloud.skywalking.web.util.Constants;
import com.ai.cloud.skywalking.web.bo.LoginUserInfo;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;

@@ -12,7 +14,28 @@ public class BaseController {
        String base = request.getContextPath();
        String fullPath = request.getScheme() + "://" + request.getServerName() +
                ":" + request.getServerPort() + base;

        LoginUserInfo loginUserInfo = (LoginUserInfo) request.getSession().getAttribute(Constants.SESSION_LOGIN_INFO_KEY);
        if (loginUserInfo != null) {
            model.addAttribute("loginUser", loginUserInfo);
        }
        model.addAttribute("_base", base);

    }


    protected LoginUserInfo fetchLoginUserInfoFromSession(HttpServletRequest request) {
        //Get login user Id
        LoginUserInfo loginUserInfo = (LoginUserInfo) request.getSession().
                getAttribute(Constants.SESSION_LOGIN_INFO_KEY);
        if (loginUserInfo == null) {
            throw new RuntimeException("Failed to find login user info");
        }

        if (loginUserInfo.getUid() == null) {
            throw new RuntimeException("Login user Id is null");
        }

        return loginUserInfo;
    }
}
Loading