Skip to content

Commit 6ab275e

Browse files
committed
Add missing catch
1 parent a59399a commit 6ab275e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapAuthenticator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import javax.inject.Inject;
2525

26+
import com.cloud.exception.ResourceAllocationException;
2627
import org.apache.cloudstack.acl.RoleType;
2728
import org.apache.cloudstack.auth.UserAuthenticator;
2829
import org.apache.commons.collections.CollectionUtils;
@@ -170,7 +171,12 @@ Pair<Boolean, ActionOnFailedAuthentication> authenticate(String username, String
170171
if (mappedAccount == null || mappedAccount.getRemoved() != null) {
171172
throw new CloudRuntimeException("Mapped account for users does not exist. Please contact your administrator.");
172173
}
173-
_accountManager.moveUser(userAccount.getId(), userAccount.getDomainId(), mappedAccount);
174+
try {
175+
_accountManager.moveUser(userAccount.getId(), userAccount.getDomainId(), mappedAccount);
176+
} catch (ResourceAllocationException e) {
177+
throw new CloudRuntimeException(String.format("Failed to move User [%s] to mapped Account [%s] due to insufficient Project limits.",
178+
userAccount.getUsername(), mappedAccount.getAccountName()), e);
179+
}
174180
}
175181
// else { the user hasn't changed in ldap, the ldap group stayed the same, hurray, pass, fun thou self a lot of fun }
176182
}

0 commit comments

Comments
 (0)