mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
CLOUDSTACK-617: Unable to edit a sub-domain. Change UpdateDomain to be consistent with CreateDomain i.e. before this operation, while checking if the domain-name is unique, search under the parent domain instead of searching under the ROOT domain.
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
697d4d8832
commit
99556a4f30
@ -1513,10 +1513,11 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
Account caller = UserContext.current().getCaller();
|
Account caller = UserContext.current().getCaller();
|
||||||
_accountMgr.checkAccess(caller, domain);
|
_accountMgr.checkAccess(caller, domain);
|
||||||
|
|
||||||
// domain name is unique in the cloud
|
// domain name is unique under the parent domain
|
||||||
if (domainName != null) {
|
if (domainName != null) {
|
||||||
SearchCriteria<DomainVO> sc = _domainDao.createSearchCriteria();
|
SearchCriteria<DomainVO> sc = _domainDao.createSearchCriteria();
|
||||||
sc.addAnd("name", SearchCriteria.Op.EQ, domainName);
|
sc.addAnd("name", SearchCriteria.Op.EQ, domainName);
|
||||||
|
sc.addAnd("parent", SearchCriteria.Op.EQ, domain.getParent());
|
||||||
List<DomainVO> domains = _domainDao.search(sc, null);
|
List<DomainVO> domains = _domainDao.search(sc, null);
|
||||||
|
|
||||||
boolean sameDomain = (domains.size() == 1 && domains.get(0).getId() == domainId);
|
boolean sameDomain = (domains.size() == 1 && domains.get(0).getId() == domainId);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user