Search in sources :

Example 1 with AuthType

use of com.cubrid.cubridmanager.core.cubrid.user.model.AuthType in project cubrid-manager by CUBRID.

the class GetAllUserAuthorizationsTask method execute.

public void execute() {
    String sql = "SELECT grantor_name, grantee_name, class_name, auth_type, is_grantable FROM db_auth";
    sql = databaseInfo.wrapShardQuery(sql);
    try {
        stmt = connection.createStatement();
        rs = stmt.executeQuery(sql);
        while (rs.next()) {
            //String grantorName = rs.getString("grantor_name");
            String granteeName = rs.getString("grantee_name");
            String className = rs.getString("class_name");
            String authType = rs.getString("auth_type");
            boolean isGrantable = StringUtil.booleanValueWithYN(rs.getString("is_grantable"));
            //				}
            if (StringUtil.isEmpty(className)) {
                continue;
            }
            if (granteeName != null) {
                granteeName = granteeName.toLowerCase(Locale.getDefault());
            }
            UserDetailInfo userInfo = allAuthMap.get(granteeName);
            if (userInfo == null) {
                userInfo = new UserDetailInfo();
                userInfo.setUserName(granteeName);
                allAuthMap.put(granteeName, userInfo);
            }
            AuthType type = AuthType.getAuthType(authType, isGrantable);
            userInfo.addAuth(className, type);
        }
    } catch (SQLException e) {
        errorMsg = e.getMessage();
    } finally {
        QueryUtil.freeQuery(stmt, rs);
    }
    loadDetailInfo();
    finish();
}
Also used : SQLException(java.sql.SQLException) AuthType(com.cubrid.cubridmanager.core.cubrid.user.model.AuthType) UserDetailInfo(com.cubrid.cubridmanager.core.cubrid.user.model.UserDetailInfo)

Aggregations

AuthType (com.cubrid.cubridmanager.core.cubrid.user.model.AuthType)1 UserDetailInfo (com.cubrid.cubridmanager.core.cubrid.user.model.UserDetailInfo)1 SQLException (java.sql.SQLException)1