xref: /AOO41X/main/connectivity/source/inc/mysql/YUser.hxx (revision caf5cd79edad04a48dcaf209068b3b89eae4622e)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CONNECTIVITY_MYSQL_USER_HXX_
25 #define _CONNECTIVITY_MYSQL_USER_HXX_
26 
27 #include "connectivity/sdbcx/VUser.hxx"
28 #include "com/sun/star/sdbc/XConnection.hpp"
29 
30 namespace connectivity
31 {
32     namespace mysql
33     {
34         typedef connectivity::sdbcx::OUser OUser_TYPEDEF;
35 
36         class OMySQLUser : public OUser_TYPEDEF
37         {
38             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
39 
40             ::rtl::OUString getPrivilegeString(sal_Int32 nRights) const;
41             // return the privileges and additional the grant rights
42             void findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
43         public:
44             virtual void refreshGroups();
45         public:
46             OMySQLUser(  const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
47             OMySQLUser(  const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,const ::rtl::OUString& _Name);
48 
49             // XUser
50             virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
51             // XAuthorizable
52             virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
53             virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
54             virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
55             virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
56         };
57 
58         class OUserExtend;
59         typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP;
60 
61         class OUserExtend : public OMySQLUser,
62                             public OUserExtend_PROP
63         {
64         protected:
65             ::rtl::OUString m_Password;
66             // OPropertyArrayUsageHelper
67             virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
68             // OPropertySetHelper
69             virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
70         public:
71             OUserExtend(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
72 
73             virtual void construct();
74         };
75     }
76 }
77 #endif // _CONNECTIVITY_MYSQL_USER_HXX_
78 
79