bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / ado / AGroup.cxx
blob0b251a6f2cf39648974daf9b51737523a65321ee
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <ado/AGroup.hxx>
22 #include <ado/AUsers.hxx>
23 #include <cppuhelper/typeprovider.hxx>
24 #include <com/sun/star/sdbc/XRow.hpp>
25 #include <com/sun/star/sdbc/XResultSet.hpp>
26 #include <ado/AConnection.hxx>
27 #include <TConnection.hxx>
29 using namespace connectivity::ado;
30 using namespace com::sun::star::uno;
31 using namespace com::sun::star::lang;
32 using namespace com::sun::star::beans;
33 using namespace com::sun::star::sdbc;
34 using namespace com::sun::star::sdbcx;
37 void WpADOGroup::Create()
39 ADOGroup* pGroup = nullptr;
40 HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOGROUP_25,
41 nullptr,
42 CLSCTX_INPROC_SERVER,
43 ADOS::IID_ADOGROUP_25,
44 reinterpret_cast<void**>(&pGroup) );
47 if( !FAILED( hr ) )
49 operator=( pGroup );
50 pGroup->Release();
54 OAdoGroup::OAdoGroup(OCatalog* _pParent,bool _bCase, ADOGroup* _pGroup) : OGroup_ADO(_bCase),m_pCatalog(_pParent)
56 construct();
57 if(_pGroup)
58 m_aGroup = WpADOGroup(_pGroup);
59 else
60 m_aGroup.Create();
64 OAdoGroup::OAdoGroup(OCatalog* _pParent,bool _bCase, const OUString& Name) : OGroup_ADO(Name,_bCase),m_pCatalog(_pParent)
66 construct();
67 m_aGroup.Create();
68 m_aGroup.put_Name(Name);
71 void OAdoGroup::refreshUsers()
73 ::std::vector< OUString> aVector;
75 WpADOUsers aUsers = m_aGroup.get_Users();
76 aUsers.fillElementNames(aVector);
78 if(m_pUsers)
79 m_pUsers->reFill(aVector);
80 else
81 m_pUsers.reset(new OUsers(m_pCatalog, m_aMutex, aVector, aUsers, isCaseSensitive()));
84 Sequence< sal_Int8 > OAdoGroup::getUnoTunnelImplementationId()
86 static ::cppu::OImplementationId implId;
88 return implId.getImplementationId();
91 // css::lang::XUnoTunnel
93 sal_Int64 OAdoGroup::getSomething( const Sequence< sal_Int8 > & rId )
95 return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
96 ? reinterpret_cast< sal_Int64 >( this )
97 : OGroup_ADO::getSomething(rId);
101 void OAdoGroup::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
103 if(m_aGroup.IsValid())
106 switch(nHandle)
108 case PROPERTY_ID_NAME:
110 OUString aVal;
111 rValue >>= aVal;
112 m_aGroup.put_Name(aVal);
114 break;
119 void OAdoGroup::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
121 if(m_aGroup.IsValid())
123 switch(nHandle)
125 case PROPERTY_ID_NAME:
126 rValue <<= m_aGroup.get_Name();
127 break;
133 sal_Int32 SAL_CALL OAdoGroup::getPrivileges( const OUString& objName, sal_Int32 objType )
135 return MapRight(m_aGroup.GetPermissions(objName,MapObjectType(objType)));
138 sal_Int32 SAL_CALL OAdoGroup::getGrantablePrivileges( const OUString& objName, sal_Int32 objType )
140 RightsEnum eNum = m_aGroup.GetPermissions(objName,MapObjectType(objType));
141 if(eNum & adRightWithGrant)
142 return MapRight(eNum);
143 return 0;
146 void SAL_CALL OAdoGroup::grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges )
148 m_aGroup.SetPermissions(objName,MapObjectType(objType),adAccessGrant,Map2Right(objPrivileges));
151 void SAL_CALL OAdoGroup::revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges )
153 m_aGroup.SetPermissions(objName,MapObjectType(objType),adAccessDeny,Map2Right(objPrivileges));
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */