Search in sources :

Example 1 with GetShareInfoRequest

use of com.zimbra.soap.admin.message.GetShareInfoRequest 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);
}
Also used : OperationContext(com.zimbra.cs.mailbox.OperationContext) Account(com.zimbra.cs.account.Account) ResultFilterByTarget(com.zimbra.cs.service.account.GetShareInfo.ResultFilterByTarget) GranteeChooser(com.zimbra.soap.type.GranteeChooser) GetShareInfoResponse(com.zimbra.soap.admin.message.GetShareInfoResponse) Provisioning(com.zimbra.cs.account.Provisioning) AccountBy(com.zimbra.common.account.Key.AccountBy) ResultFilter(com.zimbra.cs.service.account.GetShareInfo.ResultFilter) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) GetShareInfoRequest(com.zimbra.soap.admin.message.GetShareInfoRequest) ShareInfoVisitor(com.zimbra.cs.service.account.GetShareInfo.ShareInfoVisitor)

Aggregations

AccountBy (com.zimbra.common.account.Key.AccountBy)1 Account (com.zimbra.cs.account.Account)1 Provisioning (com.zimbra.cs.account.Provisioning)1 OperationContext (com.zimbra.cs.mailbox.OperationContext)1 ResultFilter (com.zimbra.cs.service.account.GetShareInfo.ResultFilter)1 ResultFilterByTarget (com.zimbra.cs.service.account.GetShareInfo.ResultFilterByTarget)1 ShareInfoVisitor (com.zimbra.cs.service.account.GetShareInfo.ShareInfoVisitor)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 GetShareInfoRequest (com.zimbra.soap.admin.message.GetShareInfoRequest)1 GetShareInfoResponse (com.zimbra.soap.admin.message.GetShareInfoResponse)1 GranteeChooser (com.zimbra.soap.type.GranteeChooser)1