Skip to content

Commit 9fd38c4

Browse files
authored
server: Display proper names in error message (#5140)
Display the proper account and other names rather than the uuid representation of the object
1 parent 9ac3925 commit 9fd38c4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

server/src/main/java/com/cloud/acl/DomainChecker.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected DomainChecker() {
105105
@Override
106106
public boolean checkAccess(Account caller, Domain domain) throws PermissionDeniedException {
107107
if (caller.getState() != Account.State.enabled) {
108-
throw new PermissionDeniedException(caller + " is disabled.");
108+
throw new PermissionDeniedException("Account " + caller.getAccountName() + " is disabled.");
109109
}
110110

111111
if (domain == null) {
@@ -116,10 +116,10 @@ public boolean checkAccess(Account caller, Domain domain) throws PermissionDenie
116116

117117
if (_accountService.isNormalUser(caller.getId())) {
118118
if (caller.getDomainId() != domainId) {
119-
throw new PermissionDeniedException(caller + " does not have permission to operate within domain id=" + domain.getUuid());
119+
throw new PermissionDeniedException("Account " + caller.getAccountName() + " does not have permission to operate within domain id=" + domain.getUuid());
120120
}
121121
} else if (!_domainDao.isChildDomain(caller.getDomainId(), domainId)) {
122-
throw new PermissionDeniedException(caller + " does not have permission to operate within domain id=" + domain.getUuid());
122+
throw new PermissionDeniedException("Account " + caller.getAccountName() + " does not have permission to operate within domain id=" + domain.getUuid());
123123
}
124124

125125
return true;
@@ -155,7 +155,8 @@ public boolean checkAccess(Account caller, ControlledEntity entity, AccessType a
155155
// account can launch a VM from this template
156156
LaunchPermissionVO permission = _launchPermissionDao.findByTemplateAndAccount(template.getId(), caller.getId());
157157
if (permission == null) {
158-
throw new PermissionDeniedException(caller + " does not have permission to launch instances from " + template);
158+
throw new PermissionDeniedException("Account " + caller.getAccountName() +
159+
" does not have permission to launch instances from template " + template.getName());
159160
}
160161
} else {
161162
// Domain admin and regular user can delete/modify only templates created by them

0 commit comments

Comments
 (0)