STDMETHODIMP InterfaceIMAPFolderPermissions::Add(IInterfaceIMAPFolderPermission **pVal)
{
   try
   {
      if (!m_pACLPermissions)
         return GetAccessDenied();

      if (!m_pAuthentication->GetIsDomainAdmin())
         return m_pAuthentication->GetAccessDenied();
   
      if (!m_pACLPermissions)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceIMAPFolderPermission>* pIntACLPermission = new CComObject<InterfaceIMAPFolderPermission>();
      pIntACLPermission->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::ACLPermission> pACLPermission = shared_ptr<HM::ACLPermission>(new HM::ACLPermission);
   
      pACLPermission->SetShareFolderID(m_pFolder->GetID());
   
      pIntACLPermission->AttachItem(pACLPermission);
      pIntACLPermission->AttachParent(m_pACLPermissions, false);
   
      pIntACLPermission->AddRef();
      *pVal = pIntACLPermission;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceBlockedAttachments::Add(IInterfaceBlockedAttachment **pVal)
{
   try
   {
      if (!m_pBlockedAttachments)
         return GetAccessDenied();

      if (!m_pBlockedAttachments)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceBlockedAttachment>* pInterfaceBlockedAttachment = new CComObject<InterfaceBlockedAttachment>();
      pInterfaceBlockedAttachment->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::BlockedAttachment> pBA = shared_ptr<HM::BlockedAttachment>(new HM::BlockedAttachment);
   
      pInterfaceBlockedAttachment->AttachItem(pBA);
      pInterfaceBlockedAttachment->AttachParent(m_pBlockedAttachments, false);
   
      pInterfaceBlockedAttachment->AddRef();
   
      *pVal = pInterfaceBlockedAttachment;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Example #3
0
STDMETHODIMP InterfaceAliases::get_Item(long Index, IInterfaceAlias **pVal)
{
   try
   {
      if (!m_pAliases)
         return GetAccessDenied();

      CComObject<InterfaceAlias>* pAlias = new CComObject<InterfaceAlias>();
      pAlias->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Alias> pPersAlias = m_pAliases->GetItem(Index);
   
      if (!pPersAlias)
         return DISP_E_BADINDEX;  
   
      pAlias->AttachItem(pPersAlias);
      pAlias->AddRef();
      *pVal = pAlias;
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceLinks::get_Alias(long DBID, IInterfaceAlias **pVal)
{
   try
   {
      if (!authentication_->GetIsAuthenticated())
         return authentication_->GetAccessDenied();
   
      shared_ptr<HM::Alias> pAlias = shared_ptr<HM::Alias>(new HM::Alias);
      if (!HM::PersistentAlias::ReadObject(pAlias, DBID))
         return DISP_E_BADINDEX;
   
      bool domainAdminOK = authentication_->GetIsDomainAdmin() && authentication_->GetDomainID() == pAlias->GetDomainID();
   
      if (!authentication_->GetIsServerAdmin() && !domainAdminOK)
         return authentication_->GetAccessDenied();
   
      CComObject<InterfaceAlias>* pInterface = new CComObject<InterfaceAlias>();
      pInterface->SetAuthentication(authentication_);
      pInterface->AttachItem(pAlias);
      pInterface->AddRef();
      *pVal = pInterface;
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceIMAPFolderPermission::get_Group(IInterfaceGroup **pVal)
{
   try
   {
      if (!object_)
         return GetAccessDenied();

      CComObject<InterfaceGroup>* pInterfaceGroup = new CComObject<InterfaceGroup>();
      pInterfaceGroup->SetAuthentication(authentication_);
   
      std::shared_ptr<HM::Group> pGroup = HM::Configuration::Instance()->GetIMAPConfiguration()->GetGroups()->GetItemByDBID(object_->GetPermissionGroupID());
   
      if (!pGroup)
         return DISP_E_BADINDEX;
   
      pInterfaceGroup->AttachItem(pGroup);
      pInterfaceGroup->AddRef();
      *pVal = pInterfaceGroup;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceGreyListingWhiteAddresses::Add(IInterfaceGreyListingWhiteAddress **pVal)
{
   try
   {
      if (!gl_white_addresses_)
         return GetAccessDenied();

      if (!gl_white_addresses_)
         return authentication_->GetAccessDenied();
   
      CComObject<InterfaceGreyListingWhiteAddress>* pInterfaceGreyListingWhiteAddress = new CComObject<InterfaceGreyListingWhiteAddress>();
      pInterfaceGreyListingWhiteAddress->SetAuthentication(authentication_);
   
      shared_ptr<HM::GreyListingWhiteAddress> pBA = shared_ptr<HM::GreyListingWhiteAddress>(new HM::GreyListingWhiteAddress);
   
      pInterfaceGreyListingWhiteAddress->AttachItem(pBA);
      pInterfaceGreyListingWhiteAddress->AttachParent(gl_white_addresses_, false);
      pInterfaceGreyListingWhiteAddress->AddRef();
   
      *pVal = pInterfaceGreyListingWhiteAddress;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceSSLCertificates::Add(IInterfaceSSLCertificate **pVal)
{
   try
   {
      if (!m_pSSLCertificates)
         return GetAccessDenied();

      if (!m_pSSLCertificates)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceSSLCertificate>* pInterfaceSSLCertificate = new CComObject<InterfaceSSLCertificate>();
      pInterfaceSSLCertificate->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::SSLCertificate> pBA = shared_ptr<HM::SSLCertificate>(new HM::SSLCertificate);
   
      pInterfaceSSLCertificate->AttachItem(pBA);
      pInterfaceSSLCertificate->AttachParent(m_pSSLCertificates, false);
      pInterfaceSSLCertificate->AddRef();
   
      *pVal = pInterfaceSSLCertificate;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceIncomingRelays::get_Item(long Index, IInterfaceIncomingRelay **pVal)
{
   try
   {
      if (!m_pIncomingRelays)
         return GetAccessDenied();

      CComObject<InterfaceIncomingRelay>* pRangeInt = new CComObject<InterfaceIncomingRelay>();
      pRangeInt->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::IncomingRelay> pRange = m_pIncomingRelays->GetItem(Index);
   
      if (pRange)
      {
         pRangeInt->AttachItem(pRange);
         pRangeInt->AttachParent(m_pIncomingRelays, true);
         pRangeInt->AddRef();
         *pVal = pRangeInt;
      }
      else
      {
         return DISP_E_BADINDEX;  
      }
   
   
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceMessages::get_ItemByDBID(hyper DBID, IInterfaceMessage **pVal)
{
   try
   {
      if (!messages_)
         return GetAccessDenied();

      //	

      CComObject<InterfaceMessage>* pInterfaceMessage = new CComObject<InterfaceMessage>();
      pInterfaceMessage->SetAuthentication(authentication_);

      std::shared_ptr<HM::Message> pMsg = messages_->GetItemByDBID(DBID);

      if (pMsg)
      {
         pInterfaceMessage->AttachItem(pMsg);
         pInterfaceMessage->AddRef();
         *pVal = pInterfaceMessage;
      }
      else
      {
         return DISP_E_BADINDEX;
      }

      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceSURBLServers::get_ItemByDBID(long lDBID, IInterfaceSURBLServer **pVal)
{
   try
   {
      if (!surbl_servers_)
         return GetAccessDenied();

      CComObject<InterfaceSURBLServer>* pInterfaceSURBLServer = new CComObject<InterfaceSURBLServer>();
      pInterfaceSURBLServer->SetAuthentication(authentication_);
   
      std::shared_ptr<HM::SURBLServer> pDNSBlackList = surbl_servers_->GetItemByDBID(lDBID);
   
      if (!pDNSBlackList)
         return DISP_E_BADINDEX;
   
      pInterfaceSURBLServer->AttachItem(pDNSBlackList);
      pInterfaceSURBLServer->AttachParent(surbl_servers_, true);
      pInterfaceSURBLServer->AddRef();
   
      *pVal = pInterfaceSURBLServer;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceIncomingRelays::Add(IInterfaceIncomingRelay **pVal)
{
   try
   {
      if (!m_pIncomingRelays)
         return GetAccessDenied();

      if (!m_pIncomingRelays)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceIncomingRelay>* pInterfaceRange = new CComObject<InterfaceIncomingRelay>();
      pInterfaceRange->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::IncomingRelay> pRange = shared_ptr<HM::IncomingRelay>(new HM::IncomingRelay); 
   
      pInterfaceRange->AttachItem(pRange);
      pInterfaceRange->AttachParent(m_pIncomingRelays, false);
   
      pInterfaceRange->AddRef();
      *pVal = pInterfaceRange;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceIMAPFolder::get_Permissions(IInterfaceIMAPFolderPermissions **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      if (!m_pObject->IsPublicFolder())
      {
         // This is not a public  folder. Not possible to modify permissions.
         return COMError::GenerateError("It is only possible to modify permissions for public folders.");
      }
   
      CComObject<InterfaceIMAPFolderPermissions>* pItem = new CComObject<InterfaceIMAPFolderPermissions >();
      pItem->SetAuthentication(m_pAuthentication);
   
      if (m_pObject)
      {
         pItem->AttachItem(m_pObject);
         pItem->AddRef();
         *pVal = pItem;
      }
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceAccounts::Add(IInterfaceAccount **pVal)
{
   try
   {
      if (!m_pAccounts)
         return GetAccessDenied();

      if (!m_pAuthentication->GetIsDomainAdmin())
         return m_pAuthentication->GetAccessDenied();
   
      if (!m_pAccounts)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceAccount>* pAccountInterface = new CComObject<InterfaceAccount>();
      pAccountInterface->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Account> pAccount = shared_ptr<HM::Account>(new HM::Account);
   
      pAccount->SetDomainID(m_iDomainID);
      
      pAccountInterface->AttachItem(pAccount);
      pAccountInterface->AttachParent(m_pAccounts, false);
      pAccountInterface->SetAuthentication(m_pAuthentication);
      pAccountInterface->AddRef();
   
      *pVal = pAccountInterface;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceAccounts::get_ItemByAddress(BSTR Address, IInterfaceAccount **pVal)
{
   try
   {
      if (!m_pAccounts)
         return GetAccessDenied();

   
      CComObject<InterfaceAccount>* pAccountInt = new CComObject<InterfaceAccount>();
      pAccountInt->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Account> pAccount = m_pAccounts->GetItemByName(Address);
   
      if (!pAccount)
         return DISP_E_BADINDEX; 
   
      pAccountInt->AttachItem(pAccount);
      pAccountInt->SetAuthentication(m_pAuthentication);
      pAccountInt->AttachParent(m_pAccounts, true);
      pAccountInt->AddRef();
      *pVal = pAccountInt;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceFetchAccounts::Add(IInterfaceFetchAccount **pVal)
{
   try
   {
      if (!m_pFetchAccounts)
         return GetAccessDenied();

      if (!m_pFetchAccounts)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceFetchAccount>* pIntFA = new CComObject<InterfaceFetchAccount>();
      pIntFA->SetAuthentication(m_pAuthentication);
   
      boost::shared_ptr<HM::FetchAccount> pFA = boost::shared_ptr<HM::FetchAccount>(new HM::FetchAccount);
   
      pFA->SetAccountID(m_pFetchAccounts->GetAccountID());
   
      pIntFA->AttachItem(pFA);
      pIntFA->AttachParent(m_pFetchAccounts, false);
   
      pIntFA->AddRef();
      *pVal = pIntFA;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Example #16
0
STDMETHODIMP 
InterfaceGroups::Add(IInterfaceGroup **pVal)
{
   try
   {
      if (!m_pGroups)
         return GetAccessDenied();

      if (!m_pGroups)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceGroup>* pInterfaceGroup = new CComObject<InterfaceGroup>();
      pInterfaceGroup->SetAuthentication(m_pAuthentication);
   
      boost::shared_ptr<HM::Group> pBA = boost::shared_ptr<HM::Group>(new HM::Group);
   
      pInterfaceGroup->AttachItem(pBA);
      pInterfaceGroup->AttachParent(m_pGroups, false);
   
      pInterfaceGroup->AddRef();
   
      *pVal = pInterfaceGroup;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceFetchAccounts::get_Item(long lIndex, IInterfaceFetchAccount** pVal)
{
   try
   {
      if (!m_pFetchAccounts)
         return GetAccessDenied();

      CComObject<InterfaceFetchAccount>* pInterfaceAccount = new CComObject<InterfaceFetchAccount>();
      pInterfaceAccount->SetAuthentication(m_pAuthentication);
   
      boost::shared_ptr<HM::FetchAccount> pFetchAccount = m_pFetchAccounts->GetItem(lIndex);
      if (!pFetchAccount)
         return DISP_E_BADINDEX;
   
      pInterfaceAccount->AttachItem(pFetchAccount);
      pInterfaceAccount->AttachParent(m_pFetchAccounts, true);
      pInterfaceAccount->AddRef();
      *pVal = pInterfaceAccount;   
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Example #18
0
STDMETHODIMP 
InterfaceGroups::get_Item(long Index, IInterfaceGroup **pVal)
{
   try
   {
      if (!m_pGroups)
         return GetAccessDenied();

      CComObject<InterfaceGroup>* pInterfaceGroup = new CComObject<InterfaceGroup>();
      pInterfaceGroup->SetAuthentication(m_pAuthentication);
   
      boost::shared_ptr<HM::Group> pBA = m_pGroups->GetItem(Index);
   
      if (!pBA)
         return DISP_E_BADINDEX;
   
      pInterfaceGroup->AttachItem(pBA);
      pInterfaceGroup->AttachParent(m_pGroups, true);
      pInterfaceGroup->AddRef();
      *pVal = pInterfaceGroup;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceGreyListingWhiteAddresses::get_Item(long Index, IInterfaceGreyListingWhiteAddress **pVal)
{
   try
   {
      if (!gl_white_addresses_)
         return GetAccessDenied();

      CComObject<InterfaceGreyListingWhiteAddress>* pInterfaceGreyListingWhiteAddress = new CComObject<InterfaceGreyListingWhiteAddress>();
      pInterfaceGreyListingWhiteAddress->SetAuthentication(authentication_);
   
      shared_ptr<HM::GreyListingWhiteAddress> pBA = gl_white_addresses_->GetItem(Index);
   
      if (!pBA)
         return DISP_E_BADINDEX;
   
      pInterfaceGreyListingWhiteAddress->AttachItem(pBA);
      pInterfaceGreyListingWhiteAddress->AttachParent(gl_white_addresses_, true);
      pInterfaceGreyListingWhiteAddress->AddRef();
      *pVal = pInterfaceGreyListingWhiteAddress;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP
InterfaceSURBLServers::Add(IInterfaceSURBLServer **pVal)
{
    try
    {
        if (!m_pSURBLServers)
            return GetAccessDenied();

        if (!m_pSURBLServers)
            return m_pAuthentication->GetAccessDenied();

        CComObject<InterfaceSURBLServer>* pInterfaceSURBLServer = new CComObject<InterfaceSURBLServer>();
        pInterfaceSURBLServer->SetAuthentication(m_pAuthentication);

        shared_ptr<HM::SURBLServer> pDNSBL = shared_ptr<HM::SURBLServer>(new HM::SURBLServer);

        pInterfaceSURBLServer->AttachItem(pDNSBL);
        pInterfaceSURBLServer->AttachParent(m_pSURBLServers, false);

        pInterfaceSURBLServer->AddRef();

        *pVal = pInterfaceSURBLServer;

        return S_OK;
    }
    catch (...)
    {
        return COMError::GenerateGenericMessage();
    }
}
STDMETHODIMP 
InterfaceSSLCertificates::get_Item(long Index, IInterfaceSSLCertificate **pVal)
{
   try
   {
      if (!m_pSSLCertificates)
         return GetAccessDenied();

      CComObject<InterfaceSSLCertificate>* pInterfaceSSLCertificate = new CComObject<InterfaceSSLCertificate>();
      pInterfaceSSLCertificate->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::SSLCertificate> pBA = m_pSSLCertificates->GetItem(Index);
   
      if (!pBA)
         return DISP_E_BADINDEX;
   
      pInterfaceSSLCertificate->AttachItem(pBA);
      pInterfaceSSLCertificate->AttachParent(m_pSSLCertificates, true);
      pInterfaceSSLCertificate->AddRef();
      *pVal = pInterfaceSSLCertificate;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP
InterfaceSURBLServers::get_ItemByDNSHost(BSTR ItemName, IInterfaceSURBLServer **pVal)
{
    try
    {
        if (!m_pSURBLServers)
            return GetAccessDenied();

        CComObject<InterfaceSURBLServer>* pInterfaceSURBLServer = new CComObject<InterfaceSURBLServer>();
        pInterfaceSURBLServer->SetAuthentication(m_pAuthentication);

        shared_ptr<HM::SURBLServer> pDNSBL = m_pSURBLServers->GetItemByName(ItemName);
        if (!pDNSBL)
            return S_FALSE;

        pInterfaceSURBLServer->AttachItem(pDNSBL);
        pInterfaceSURBLServer->AttachParent(m_pSURBLServers, true);
        pInterfaceSURBLServer->AddRef();

        *pVal = pInterfaceSURBLServer;

        return S_OK;
    }
    catch (...)
    {
        return COMError::GenerateGenericMessage();
    }
}
STDMETHODIMP 
InterfaceIMAPFolderPermission::get_Account(IInterfaceAccount **pVal)
{
   try
   {
      if (!object_)
         return GetAccessDenied();

      CComObject<InterfaceAccount>* pInterfaceAccount = new CComObject<InterfaceAccount>();
      pInterfaceAccount->SetAuthentication(authentication_);
   
      std::shared_ptr<HM::Account> pAccount = std::shared_ptr<HM::Account>(new HM::Account);
   
      if (!HM::PersistentAccount::ReadObject(pAccount, (__int64) object_->GetPermissionAccountID()))
         return DISP_E_BADINDEX;
   
      pInterfaceAccount->AttachItem(pAccount);
      pInterfaceAccount->AddRef();
      *pVal = pInterfaceAccount;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP
InterfaceSURBLServers::get_Item(long Index, IInterfaceSURBLServer **pVal)
{
    try
    {
        if (!m_pSURBLServers)
            return GetAccessDenied();

        CComObject<InterfaceSURBLServer>* pInterfaceSURBLServer = new CComObject<InterfaceSURBLServer>();
        pInterfaceSURBLServer->SetAuthentication(m_pAuthentication);

        shared_ptr<HM::SURBLServer> pDNSBlackList = m_pSURBLServers->GetItem(Index);

        if (!pDNSBlackList)
            return DISP_E_BADINDEX;

        pInterfaceSURBLServer->AttachItem(pDNSBlackList);
        pInterfaceSURBLServer->AttachParent(m_pSURBLServers, true);
        pInterfaceSURBLServer->AddRef();
        *pVal = pInterfaceSURBLServer;

        return S_OK;
    }
    catch (...)
    {
        return COMError::GenerateGenericMessage();
    }
}
STDMETHODIMP 
InterfaceRecipients::get_Item(long Index, IInterfaceRecipient **pVal)
{
   try
   {
      if (!m_pMessage)
         return GetAccessDenied();

      CComObject<InterfaceRecipient>* pInterfaceRecipient = new CComObject<InterfaceRecipient>();
      pInterfaceRecipient->SetAuthentication(m_pAuthentication);
   
      std::vector<shared_ptr<HM::MessageRecipient> > vecRecipients = m_pMessage->GetRecipients()->GetVector();
   
      if (Index >= (long) vecRecipients.size())
         return DISP_E_BADINDEX;
   
      shared_ptr<HM::MessageRecipient> pRecipient = vecRecipients[Index];
   
      pInterfaceRecipient->AttachItem(pRecipient);
      pInterfaceRecipient->AddRef();
      *pVal = pInterfaceRecipient;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceDistributionLists::get_ItemByAddress(BSTR sAddress, IInterfaceDistributionList **pVal)
{
   try
   {
      if (!m_pDistributionLists)
         return GetAccessDenied();

      CComObject<InterfaceDistributionList>* pList = new CComObject<InterfaceDistributionList>();
      pList->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::DistributionList> pPersList = m_pDistributionLists->GetItemByAddress(sAddress);
   
      if (!pPersList)
         return DISP_E_BADINDEX;  
   
      pList->AttachItem(pPersList);
      pList->AttachParent(m_pDistributionLists, true);
      pList->AddRef();
      *pVal = pList;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceBlockedAttachments::get_ItemByDBID(long lDBID, IInterfaceBlockedAttachment **pVal)
{
   try
   {
      if (!m_pBlockedAttachments)
         return GetAccessDenied();

      CComObject<InterfaceBlockedAttachment>* pInterfaceBlockedAttachment = new CComObject<InterfaceBlockedAttachment>();
      pInterfaceBlockedAttachment->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::BlockedAttachment> pBA = m_pBlockedAttachments->GetItemByDBID(lDBID);
   
      if (!pBA)
         return DISP_E_BADINDEX;
   
      pInterfaceBlockedAttachment->AttachItem(pBA);
      pInterfaceBlockedAttachment->AttachParent(m_pBlockedAttachments, true);
      pInterfaceBlockedAttachment->AddRef();
   
      *pVal = pInterfaceBlockedAttachment;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceDistributionLists::Add(IInterfaceDistributionList **pVal)
{
   try
   {
      if (!m_pDistributionLists)
         return GetAccessDenied();

      if (!m_pDistributionLists)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceDistributionList>* pList = new CComObject<InterfaceDistributionList>();
      pList->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::DistributionList> pPersList = shared_ptr<HM::DistributionList>(new HM::DistributionList);
      pPersList->SetDomainID(m_iDomainID);
   
      pList->AttachItem(pPersList);
      pList->AttachParent(m_pDistributionLists, false);
      pList->AddRef();
   
      *pVal = pList;
   
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Example #29
0
STDMETHODIMP InterfaceAliases::Add(IInterfaceAlias **pVal)
{
   try
   {
      if (!m_pAliases)
         return GetAccessDenied();

      if (!m_pAuthentication->GetIsDomainAdmin())
         return m_pAuthentication->GetAccessDenied();
   
      if (!m_pAliases)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceAlias>* pIntAlias = new CComObject<InterfaceAlias>();
      pIntAlias->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Alias> pAliasADO = shared_ptr<HM::Alias>(new HM::Alias);
      
      pIntAlias->AttachItem(pAliasADO);
      pIntAlias->AttachParent(m_pAliases, false);
   
      pAliasADO->SetDomainID(m_iDomainID);
   
      pIntAlias->AddRef();
      *pVal = pIntAlias;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceIMAPFolderPermissions::get_Item(long Index, IInterfaceIMAPFolderPermission **pVal)
{
   try
   {
      if (!m_pACLPermissions)
         return GetAccessDenied();

      CComObject<InterfaceIMAPFolderPermission>* pACLPermission = new CComObject<InterfaceIMAPFolderPermission>();
      pACLPermission->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::ACLPermission> pPersACLPermission = m_pACLPermissions->GetItem(Index);
   
      if (!pPersACLPermission)
         return DISP_E_BADINDEX;  
   
      pACLPermission->AttachItem(pPersACLPermission);
      pACLPermission->AttachParent(m_pACLPermissions, true);
      pACLPermission->AddRef();
      *pVal = pACLPermission;
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}