Search in sources :

Example 1 with CasAuthType

use of com.cubrid.cubridmanager.core.common.model.CasAuthType in project cubrid-manager by CUBRID.

the class GetCMUserListTask method buildUserInfo.

/**
	 * 
	 * Build user info
	 * 
	 * @param serverUserInfoList List<ServerUserInfo> The given list that stored
	 *        some instance of ServerUserInfo
	 * @param node TreeNode
	 */
private void buildUserInfo(List<ServerUserInfo> serverUserInfoList, TreeNode node) {
    for (int j = 0; j < node.childrenSize(); j++) {
        TreeNode node1 = node.getChildren().get(j);
        if (node1.getValue("open") == null || !node1.getValue("open").trim().equals("user")) {
            continue;
        }
        String userId = node1.getValue("id");
        if (userId == null) {
            continue;
        }
        String password = node1.getValue("passwd");
        String casAuthInfo = node1.getValue("casauth");
        String dbCreater = node1.getValue("dbcreate");
        String statusMonitorAuthInfo = node1.getValue("statusmonitorauth");
        ServerUserInfo userInfo = new ServerUserInfo(userId, password);
        CasAuthType casAuthType = CasAuthType.AUTH_NONE;
        if (casAuthInfo != null && casAuthInfo.trim().equals(CasAuthType.AUTH_ADMIN.getText())) {
            casAuthType = CasAuthType.AUTH_ADMIN;
        } else if (casAuthInfo != null && casAuthInfo.trim().equals(CasAuthType.AUTH_MONITOR.getText())) {
            casAuthType = CasAuthType.AUTH_MONITOR;
        }
        userInfo.setCasAuth(casAuthType);
        StatusMonitorAuthType statusMonitorAuth = StatusMonitorAuthType.AUTH_NONE;
        if (statusMonitorAuthInfo != null && statusMonitorAuthInfo.trim().equals(StatusMonitorAuthType.AUTH_ADMIN.getText())) {
            statusMonitorAuth = StatusMonitorAuthType.AUTH_ADMIN;
        } else if (statusMonitorAuthInfo != null && statusMonitorAuthInfo.trim().equals(StatusMonitorAuthType.AUTH_MONITOR.getText())) {
            statusMonitorAuth = StatusMonitorAuthType.AUTH_MONITOR;
        }
        userInfo.setStatusMonitorAuth(statusMonitorAuth);
        if (userInfo.isAdmin()) {
            userInfo.setStatusMonitorAuth(StatusMonitorAuthType.AUTH_ADMIN);
        }
        if (dbCreater != null && dbCreater.equals(DbCreateAuthType.AUTH_ADMIN.getText())) {
            userInfo.setDbCreateAuthType(DbCreateAuthType.AUTH_ADMIN);
        } else {
            userInfo.setDbCreateAuthType(DbCreateAuthType.AUTH_NONE);
        }
        if (userInfo.getUserName().equals(serverInfo.getUserName())) {
            userInfo.setPassword(serverInfo.getUserPassword());
        }
        buildDbAuthInfo(node1, userInfo);
        serverUserInfoList.add(userInfo);
    }
}
Also used : CasAuthType(com.cubrid.cubridmanager.core.common.model.CasAuthType) StatusMonitorAuthType(com.cubrid.cubridmanager.core.common.model.StatusMonitorAuthType) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo)

Aggregations

CasAuthType (com.cubrid.cubridmanager.core.common.model.CasAuthType)1 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)1 StatusMonitorAuthType (com.cubrid.cubridmanager.core.common.model.StatusMonitorAuthType)1 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)1