use of com.zimbra.cs.service.admin.ModifyCalendarResource in project zm-mailbox by Zimbra.
the class TestServerEnumeration method testModifyCalresSufficientPermissions.
@Test
public void testModifyCalresSufficientPermissions() throws Exception {
List<AdminRight> relatedRights = new ArrayList<AdminRight>();
List<String> notes = new ArrayList<String>();
AdminDocumentHandler handler = new ModifyCalendarResource();
handler.docRights(relatedRights, notes);
createDelegatedAdmin(relatedRights);
grantRightToAdmin(adminSoapProv, com.zimbra.soap.type.TargetType.fromString(com.zimbra.cs.account.accesscontrol.TargetType.calresource.toString()), MY_CALRES, DELEGATED_ADMIN_NAME, Admin.R_modifyCalendarResource.getName());
grantRightToAdmin(adminSoapProv, com.zimbra.soap.type.TargetType.fromString(com.zimbra.cs.account.accesscontrol.TargetType.global.toString()), null, DELEGATED_ADMIN_NAME, Admin.R_listServer.getName());
adminSoapProv.flushCache(CacheEntryType.acl, null);
ModifyCalendarResourceRequest req = new ModifyCalendarResourceRequest(myCalRes.getId());
req.addAttr(new Attr(Provisioning.A_zimbraMailHost, NON_EXISTING_SERVER));
req.addAttr(new Attr(Provisioning.A_description, "test description"));
try {
delegatedSoapProv.invokeJaxb(req);
fail("should have caught an exception");
} catch (SoapFaultException e) {
assertEquals("should be getting 'no such server' response", AccountServiceException.NO_SUCH_SERVER, e.getCode());
}
}
use of com.zimbra.cs.service.admin.ModifyCalendarResource in project zm-mailbox by Zimbra.
the class TestServerEnumeration method testModifyCalres.
@Test
public void testModifyCalres() throws Exception {
List<AdminRight> relatedRights = new ArrayList<AdminRight>();
List<String> notes = new ArrayList<String>();
AdminDocumentHandler handler = new ModifyCalendarResource();
handler.docRights(relatedRights, notes);
createDelegatedAdmin(relatedRights);
grantRightToAdmin(adminSoapProv, com.zimbra.soap.type.TargetType.fromString(com.zimbra.cs.account.accesscontrol.TargetType.calresource.toString()), MY_CALRES, DELEGATED_ADMIN_NAME, Admin.R_modifyCalendarResource.getName());
adminSoapProv.flushCache(CacheEntryType.acl, null);
ModifyCalendarResourceRequest req = new ModifyCalendarResourceRequest(myCalRes.getId());
req.addAttr(new Attr(Provisioning.A_zimbraMailHost, NON_EXISTING_SERVER));
req.addAttr(new Attr(Provisioning.A_description, "test description"));
try {
delegatedSoapProv.invokeJaxb(req);
fail("should have caught an exception");
} catch (SoapFaultException e) {
assertEquals("should be getting 'Permission Denied' response", ServiceException.PERM_DENIED, e.getCode());
}
}
Aggregations