There are subdomain concept, so this patch doesn't fix the issue,

Kris is on this

Revert "for domain admin, only list snapshot inside this domain"

This reverts commit f314c59ba8.
This commit is contained in:
anthony 2010-10-20 11:21:51 -07:00
parent f314c59ba8
commit 21da2d6608
1 changed files with 5 additions and 18 deletions

View File

@ -90,19 +90,12 @@ public class ListSnapshotsCmd extends BaseCmd {
if (account == null) {
if (domainId != null && accountName != null) {
account = getManagementServer().findAccountByName(accountName, domainId);
if( account == null ) {
throw new ServerApiException (BaseCmd.SNAPSHOT_INVALID_PARAM_ERROR, "can not find Account by accountName " + accountName + " domainId " + domainId);
}
}
}
if( !isAdmin(account.getType())) {
if( account != null && !isAdmin(account.getType())) {
accountId = account.getId();
}
if( domainId == null ) {
domainId = account.getDomainId();
}
Long startIndex = Long.valueOf(0);
int pageSizeNum = 50;
@ -143,19 +136,13 @@ public class ListSnapshotsCmd extends BaseCmd {
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), snapshot.getId().toString()));
Account acct = getManagementServer().findAccountById(Long.valueOf(snapshot.getAccountId()));
if (acct == null || acct.getDomainId() != domainId ){
continue;
if (acct != null) {
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), acct.getAccountName()));
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), acct.getDomainId().toString()));
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN.getName(), getManagementServer().findDomainIdById(acct.getDomainId()).getName()));
}
volumeId = snapshot.getVolumeId();
VolumeVO volume = getManagementServer().findAnyVolumeById(volumeId);
if ( volume == null ){
continue;
}
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), acct.getAccountName()));
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), acct.getDomainId().toString()));
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN.getName(), getManagementServer()
.findDomainIdById(acct.getDomainId()).getName()));
String snapshotTypeStr = SnapshotType.values()[snapshot.getSnapshotType()].name();
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.SNAPSHOT_TYPE.getName(), snapshotTypeStr));
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.VOLUME_ID.getName(), volumeId));