use of com.zimbra.soap.admin.message.ModifyAccountResponse in project zm-mailbox by Zimbra.
the class TestDomainAdmin method testModifyAccountInDomAdminDomain.
@Test
public void testModifyAccountInDomAdminDomain() throws Exception {
Account acct = TestJaxbProvisioning.ensureAccountExists(TARGET_ACCT);
String acctId = acct.getId();
String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
ModifyAccountRequest modAcctReq;
ModifyAccountResponse modAcctResp;
modAcctReq = new ModifyAccountRequest(null);
modAcctReq.addAttr(new Attr(Provisioning.A_description, "dummy description"));
try {
modAcctResp = domAdminSoapProv.invokeJaxb(modAcctReq);
fail("ModifyAccountRequest succeeded without 'id'!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "invalid request: missing required attribute: id");
}
modAcctReq = new ModifyAccountRequest(acctId);
modAcctReq.addAttr(new Attr(Provisioning.A_description, "dummy description"));
modAcctResp = domAdminSoapProv.invokeJaxb(modAcctReq);
assertNotNull("ModifyAccountResponse for " + TARGET_ACCT + " simple as domAdmin", modAcctResp);
modAcctReq = new ModifyAccountRequest(acctId);
modAcctReq.addAttr(new Attr(Provisioning.A_description, "another dummy description"));
modAcctResp = domAdminSoapProv.invokeJaxbOnTargetAccount(modAcctReq, acctId);
assertNotNull("ModifyAccountResponse for " + TARGET_ACCT + " as domAdmin specifying target acct", modAcctResp);
DeleteAccountRequest delAcctReq = new DeleteAccountRequest(acctId);
DeleteAccountResponse delAcctResp = domAdminSoapProv.invokeJaxbOnTargetAccount(delAcctReq, acctId);
assertNotNull("DeleteAccountResponse for " + TARGET_ACCT + " as domAdmin specifying target acct", delAcctResp);
try {
modAcctResp = domAdminSoapProv.invokeJaxb(modAcctReq);
fail("ModifyAccountRequest succeeded after delete!");
} catch (SoapFaultException sfe) {
// Get this instead of "no such account: " because modify by ID (not name) and for domain admin
// cannot know whether that ID was for a domain we administered or not.
checkSoapReason(sfe, "permission denied: can not access account ");
}
try {
modAcctResp = domAdminSoapProv.invokeJaxbOnTargetAccount(modAcctReq, acctId);
fail("ModifyAccountRequest succeeded after delete!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access account ");
}
// as full admin
try {
modAcctResp = adminSoapProv.invokeJaxb(modAcctReq);
fail("ModifyAccountRequest succeeded after delete!");
} catch (SoapFaultException sfe) {
// Full admin gets "no such account: " instead of "permission denied"
checkSoapReason(sfe, "no such account: ");
}
}
Aggregations