use of com.zimbra.cs.service.account.GetShareInfo.ShareInfoVisitor in project zm-mailbox by Zimbra.
the class GetShareInfo method handle.
@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
OperationContext octxt = getOperationContext(zsc, context);
Provisioning prov = Provisioning.getInstance();
GetShareInfoRequest req = JaxbUtil.elementToJaxb(request);
GranteeChooser granteeChooser = req.getGrantee();
byte granteeType = com.zimbra.cs.service.account.GetShareInfo.getGranteeType(granteeChooser == null ? null : granteeChooser.getType());
String granteeId = null;
String granteeName = null;
if (granteeChooser != null) {
granteeId = granteeChooser.getId();
granteeName = granteeChooser.getName();
}
Account ownerAcct = null;
AccountBy acctBy = req.getOwner().getBy().toKeyAccountBy();
String accountSelectorKey = req.getOwner().getKey();
ownerAcct = prov.get(acctBy, accountSelectorKey);
// in the account namespace GetShareInfo
// to defend against harvest attacks return "no shares" instead of error when an invalid user name/id is used.
// this is the admin namespace GetShareInfo, we want to let the admin know if the owner name is bad
// unless the admin is a domain admin for a different domain...
defendAgainstAccountOrCalendarResourceHarvesting(ownerAcct, acctBy, accountSelectorKey, zsc, Admin.R_adminLoginAs, Admin.R_adminLoginCalendarResourceAs);
GetShareInfoResponse response = new GetShareInfoResponse();
ResultFilter resultFilter = new ResultFilterByTarget(granteeId, granteeName);
ShareInfoVisitor visitor = new ShareInfoVisitor(prov, response, null, resultFilter);
ShareInfo.Discover.discover(octxt, prov, null, granteeType, ownerAcct, visitor);
visitor.finish();
return zsc.jaxbToElement(response);
}
Aggregations