use of com.zimbra.soap.admin.message.ModifyAccountRequest in project zm-mailbox by Zimbra.
the class TestPurgeDataSource method setPurgeParams.
private void setPurgeParams(boolean purgeEnabled, long dsQuota, long totalQuota) throws Exception {
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(Provisioning.A_zimbraFeatureDataSourcePurgingEnabled, purgeEnabled ? ProvisioningConstants.TRUE : ProvisioningConstants.FALSE);
attrs.put(Provisioning.A_zimbraDataSourceQuota, String.valueOf(dsQuota));
attrs.put(Provisioning.A_zimbraDataSourceTotalQuota, String.valueOf(totalQuota));
ModifyAccountRequest modifyRequest = new ModifyAccountRequest(account.getId());
modifyRequest.setAttrs(attrs);
SoapTest.invokeJaxb(transport, modifyRequest);
}
use of com.zimbra.soap.admin.message.ModifyAccountRequest 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: ");
}
}
use of com.zimbra.soap.admin.message.ModifyAccountRequest in project zm-mailbox by Zimbra.
the class TestDomainAdmin method testModifyAccountInDiffDomain.
@Test
public void testModifyAccountInDiffDomain() throws Exception {
String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
Account acct = TestJaxbProvisioning.ensureAccountExists(DIFF_ACCT);
String acctId = acct.getId();
SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
ModifyAccountRequest modAcctReq = new ModifyAccountRequest(acctId);
modAcctReq.addAttr(new Attr(Provisioning.A_description, "dummy description"));
try {
domAdminSoapProv.invokeJaxb(modAcctReq);
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access account ");
}
try {
domAdminSoapProv.invokeJaxbOnTargetAccount(modAcctReq, acctId);
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access account ");
}
DeleteAccountRequest delAcctReq = new DeleteAccountRequest(acctId);
DeleteAccountResponse delAcctResp = adminSoapProv.invokeJaxbOnTargetAccount(delAcctReq, acctId);
assertNotNull("DeleteAccountResponse for " + DIFF_ACCT + " as ADMIN specifying target acct", delAcctResp);
try {
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 {
domAdminSoapProv.invokeJaxbOnTargetAccount(modAcctReq, acctId);
fail("ModifyAccountRequest succeeded after delete!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access account ");
}
}
Aggregations