1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <comphelper/servicehelper.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 pInterface
.CoCreateInstance(ADOS::CLSID_ADOGROUP_25
, nullptr, CLSCTX_INPROC_SERVER
);
42 OAdoGroup::OAdoGroup(OCatalog
* _pParent
,bool _bCase
, ADOGroup
* _pGroup
) : OGroup_ADO(_bCase
),m_pCatalog(_pParent
)
46 m_aGroup
.set(_pGroup
);
52 OAdoGroup::OAdoGroup(OCatalog
* _pParent
,bool _bCase
, const OUString
& Name
) : OGroup_ADO(Name
,_bCase
),m_pCatalog(_pParent
)
56 m_aGroup
.put_Name(Name
);
59 void OAdoGroup::refreshUsers()
61 ::std::vector
< OUString
> aVector
;
63 WpADOUsers aUsers
= m_aGroup
.get_Users();
64 aUsers
.fillElementNames(aVector
);
67 m_pUsers
->reFill(aVector
);
69 m_pUsers
.reset(new OUsers(m_pCatalog
, m_aMutex
, aVector
, aUsers
, isCaseSensitive()));
72 void OAdoGroup::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
,const Any
& rValue
)
74 if(m_aGroup
.IsValid())
79 case PROPERTY_ID_NAME
:
83 m_aGroup
.put_Name(aVal
);
90 void OAdoGroup::getFastPropertyValue(Any
& rValue
,sal_Int32 nHandle
) const
92 if(m_aGroup
.IsValid())
96 case PROPERTY_ID_NAME
:
97 rValue
<<= m_aGroup
.get_Name();
104 sal_Int32 SAL_CALL
OAdoGroup::getPrivileges( const OUString
& objName
, sal_Int32 objType
)
106 return MapRight(m_aGroup
.GetPermissions(objName
,MapObjectType(objType
)));
109 sal_Int32 SAL_CALL
OAdoGroup::getGrantablePrivileges( const OUString
& objName
, sal_Int32 objType
)
111 RightsEnum eNum
= m_aGroup
.GetPermissions(objName
,MapObjectType(objType
));
112 if(eNum
& adRightWithGrant
)
113 return MapRight(eNum
);
117 void SAL_CALL
OAdoGroup::grantPrivileges( const OUString
& objName
, sal_Int32 objType
, sal_Int32 objPrivileges
)
119 m_aGroup
.SetPermissions(objName
,MapObjectType(objType
),adAccessGrant
,Map2Right(objPrivileges
));
122 void SAL_CALL
OAdoGroup::revokePrivileges( const OUString
& objName
, sal_Int32 objType
, sal_Int32 objPrivileges
)
124 m_aGroup
.SetPermissions(objName
,MapObjectType(objType
),adAccessDeny
,Map2Right(objPrivileges
));
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */