Search in sources :

Example 6 with DbUserInfo

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

the class GetSchemaTaskTest method testGetSchemaTaskUnderPUBLIC.

public void testGetSchemaTaskUnderPUBLIC() {
    String dbUser = "public";
    DbUserInfo dbUserInfo = databaseInfo.getAuthLoginedDbUserInfo();
    DbUserInfo userInfo = new DbUserInfo(databaseInfo.getDbName(), dbUser, "", "", false);
    databaseInfo.setAuthLoginedDbUserInfo(userInfo);
    innerTestGetSchemaTask();
    databaseInfo.setAuthLoginedDbUserInfo(dbUserInfo);
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)

Example 7 with DbUserInfo

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

the class GetUserInfoTaskTest method testUpdateMessage.

public void testUpdateMessage() {
    // test get user list
    final CommonQueryTask<DbUserInfoList> userTask = new CommonQueryTask<DbUserInfoList>(serverInfo930, CommonSendMsg.getCommonDatabaseSendMsg(), new DbUserInfoList());
    userTask.setDbName(databaseInfo930.getDbName());
    userTask.execute();
    assertEquals(null, userTask.getErrorMsg());
    assertEquals(true, userTask.getResultModel() != null);
    List<DbUserInfo> userListInfo = userTask.getResultModel().getUserList();
    String newUserName = getUserName(userListInfo, "a");
    // test add user 
    UpdateAddUserTask task = new UpdateAddUserTask(serverInfo930, true);
    UserSendObj userSendObj = new UserSendObj();
    userSendObj.setDbname(databaseInfo930.getDbName());
    userSendObj.setUsername(newUserName);
    userSendObj.setUserpass("123456");
    userSendObj.addGroups("public");
    task.setUserSendObj(userSendObj);
    task.execute();
    task.getUserSendObj();
    task.isSuccess();
    task.setUserName("dba");
    task.setDbName(testDbName930);
    assertEquals(null, task.getErrorMsg());
    // test edit user 
    task = new UpdateAddUserTask(serverInfo930, false);
    userSendObj = new UserSendObj();
    userSendObj.setDbname(databaseInfo930.getDbName());
    userSendObj.setUsername(newUserName);
    userSendObj.setUserpass("223456");
    userSendObj.addGroups("public");
    task.setUserSendObj(userSendObj);
    task.execute();
    assertEquals(null, task.getErrorMsg());
    // test delete user
    CommonUpdateTask commonTask = new CommonUpdateTask(CommonTaskName.DELETE_USER_TASK_NAME, serverInfo930, CommonSendMsg.getDeleteUserMSGItems());
    commonTask.setDbName(databaseInfo930.getDbName());
    commonTask.setUserName(newUserName);
    commonTask.execute();
    assertEquals(null, commonTask.getErrorMsg());
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) UpdateAddUserTask(com.cubrid.cubridmanager.core.cubrid.user.task.UpdateAddUserTask) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) DbUserInfoList(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList) UserSendObj(com.cubrid.cubridmanager.core.cubrid.database.model.UserSendObj) CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)

Example 8 with DbUserInfo

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

the class SpaceInfoViewAction method isSupported.

/**
	 * Return whether this action support this object,if not support,this action
	 * will be disabled
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
	 *      .lang.Object)
	 * @param obj the Object
	 * @return <code>true</code> if support this obj;<code>false</code>
	 *         otherwise
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof ISchemaNode) {
        ISchemaNode node = (ISchemaNode) obj;
        CubridDatabase database = node.getDatabase();
        DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
        String type = node.getType();
        if ((CubridNodeType.GENERIC_VOLUME.equals(type) || CubridNodeType.DATA_VOLUME.equals(type) || CubridNodeType.INDEX_VOLUME.equals(type) || CubridNodeType.TEMP_VOLUME.equals(type)) && (dbUserInfo != null && database.isLogined())) {
            return true;
        }
    }
    return false;
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 9 with DbUserInfo

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

the class DeleteBackupPlanAction method isSupported.

/**
	 * Sets this action support this object
	 * 
	 * @see org.eclipse.jface.action.IAction.ISelectionAction
	 * @param obj Object
	 * @return boolean
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof ISchemaNode) {
        ISchemaNode node = (ISchemaNode) obj;
        CubridDatabase database = node.getDatabase();
        if (CubridNodeType.BACKUP_PLAN.equals(node.getType()) && database != null && database.isLogined()) {
            DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
            if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
                return true;
            }
        }
    } else if (obj instanceof Object[]) {
        Object[] objArr = (Object[]) obj;
        CubridDatabase database = null;
        for (Object object : objArr) {
            DefaultSchemaNode node = (DefaultSchemaNode) object;
            CubridDatabase db = node.getDatabase();
            if (database == null) {
                database = db;
            } else if (!database.getId().equals(db.getId())) {
                return false;
            }
        }
        return true;
    }
    return false;
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 10 with DbUserInfo

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

the class DeleteQueryPlanAction method isSupported.

/**
	 * Sets this action support this object
	 * 
	 * @see org.eclipse.jface.action.IAction.ISelectionAction
	 * @param obj Object
	 * @return boolean
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof ISchemaNode) {
        ISchemaNode node = (ISchemaNode) obj;
        CubridDatabase database = node.getDatabase();
        if (CubridNodeType.QUERY_PLAN.equals(node.getType()) && database != null && database.isLogined()) {
            DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
            if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
                return true;
            }
        }
    } else if (obj instanceof Object[]) {
        Object[] objArr = (Object[]) obj;
        CubridDatabase database = null;
        for (Object object : objArr) {
            DefaultSchemaNode node = (DefaultSchemaNode) object;
            CubridDatabase db = node.getDatabase();
            if (database == null) {
                database = db;
            } else if (!database.getId().equals(db.getId())) {
                return false;
            }
        }
        return true;
    }
    return false;
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Aggregations

DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)80 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)36 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)30 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)22 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)16 ArrayList (java.util.ArrayList)14 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)10 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)10 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)10 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)9 DbUserInfoList (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList)8 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)7 DatabaseEditorConfig (com.cubrid.common.ui.spi.model.DatabaseEditorConfig)6 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)6 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)6 IsDBAUserTask (com.cubrid.cubridmanager.core.cubrid.user.task.IsDBAUserTask)6 CQBDbConnectionLoader (com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader)6 HashMap (java.util.HashMap)6 CubridNodeLoader (com.cubrid.common.ui.spi.model.CubridNodeLoader)5 UpdateCMUserTask (com.cubrid.cubridmanager.core.common.task.UpdateCMUserTask)5