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);
}
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());
}
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;
}
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;
}
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;
}
Aggregations