Files
libreoffice/connectivity/source/sdbcx/VUser.cxx

189 lines
6.1 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-06-12 22:04:38 +01:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-11-29 11:28:04 +00:00
#include <connectivity/sdbcx/VUser.hxx>
2000-09-18 15:18:56 +00:00
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
2001-05-14 10:42:44 +00:00
#include "TConnection.hxx"
#include <connectivity/sdbcx/VCollection.hxx>
#include <connectivity/dbexception.hxx>
2000-10-09 11:09:06 +00:00
#include <comphelper/sequence.hxx>
2000-09-18 15:18:56 +00:00
2000-09-18 15:18:56 +00:00
using namespace connectivity;
using namespace connectivity::sdbcx;
2000-10-24 14:42:07 +00:00
using namespace ::com::sun::star::sdbc;
2000-09-18 15:18:56 +00:00
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
IMPLEMENT_SERVICE_INFO(OUser,"com.sun.star.sdbcx.VUser","com.sun.star.sdbcx.User");
OUser::OUser(bool _bCase) : OUser_BASE(m_aMutex)
, ODescriptor(OUser_BASE::rBHelper,_bCase,true)
2000-09-18 15:18:56 +00:00
, m_pGroups(NULL)
{
}
OUser::OUser(const OUString& _Name, bool _bCase) : OUser_BASE(m_aMutex)
2000-09-18 15:18:56 +00:00
,ODescriptor(OUser_BASE::rBHelper,_bCase)
,m_pGroups(NULL)
{
m_Name = _Name;
}
2000-10-17 07:36:20 +00:00
OUser::~OUser( )
{
delete m_pGroups;
}
void OUser::disposing()
2000-09-18 15:18:56 +00:00
{
OPropertySetHelper::disposing();
::osl::MutexGuard aGuard(m_aMutex);
if(m_pGroups)
m_pGroups->disposing();
}
Any SAL_CALL OUser::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
2000-09-18 15:18:56 +00:00
{
Any aRet = ODescriptor::queryInterface( rType);
return aRet.hasValue() ? aRet : OUser_BASE::queryInterface( rType);
2000-09-18 15:18:56 +00:00
}
Sequence< Type > SAL_CALL OUser::getTypes( ) throw(RuntimeException, std::exception)
2000-09-18 15:18:56 +00:00
{
2000-10-09 11:09:06 +00:00
return ::comphelper::concatSequences(ODescriptor::getTypes(),OUser_BASE::getTypes());
2000-09-18 15:18:56 +00:00
}
2000-09-18 15:18:56 +00:00
::cppu::IPropertyArrayHelper* OUser::createArrayHelper( ) const
{
Sequence< Property > aProps;
describeProperties(aProps);
return new ::cppu::OPropertyArrayHelper(aProps);
}
2000-09-18 15:18:56 +00:00
::cppu::IPropertyArrayHelper & OUser::getInfoHelper()
{
return *getArrayHelper();
2000-09-18 15:18:56 +00:00
}
2000-09-18 15:18:56 +00:00
// XUser
void SAL_CALL OUser::changePassword( const OUString& /*objPassword*/, const OUString& /*newPassword*/ ) throw(::com::sun::star::sdbc::SQLException, RuntimeException, std::exception)
2000-09-18 15:18:56 +00:00
{
::osl::MutexGuard aGuard(m_aMutex);
2001-05-14 10:42:44 +00:00
checkDisposed(OUser_BASE::rBHelper.bDisposed);
::dbtools::throwFeatureNotImplementedSQLException( "XUser::changePassword", *this );
2000-09-18 15:18:56 +00:00
}
2000-09-18 15:18:56 +00:00
// XGroupsSupplier
Reference< XNameAccess > SAL_CALL OUser::getGroups( ) throw(RuntimeException, std::exception)
2000-09-18 15:18:56 +00:00
{
::osl::MutexGuard aGuard(m_aMutex);
2001-05-14 10:42:44 +00:00
checkDisposed(OUser_BASE::rBHelper.bDisposed);
try
{
if ( !m_pGroups )
refreshGroups();
}
catch( const RuntimeException& )
{
// allowed to leave this method
throw;
}
catch( const Exception& )
{
// allowed
}
2000-09-18 15:18:56 +00:00
return m_pGroups;
2000-09-18 15:18:56 +00:00
}
SAL_WNOUNREACHABLE_CODE_PUSH
2000-09-18 15:18:56 +00:00
sal_Int32 SAL_CALL OUser::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
2000-09-18 15:18:56 +00:00
{
::osl::MutexGuard aGuard(m_aMutex);
2001-05-14 10:42:44 +00:00
checkDisposed(OUser_BASE::rBHelper.bDisposed);
::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::changePassword", *this );
2000-09-18 15:18:56 +00:00
return 0;
}
sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
2000-09-18 15:18:56 +00:00
{
::osl::MutexGuard aGuard(m_aMutex);
2001-05-14 10:42:44 +00:00
checkDisposed(OUser_BASE::rBHelper.bDisposed);
::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::getGrantablePrivileges", *this );
2000-09-18 15:18:56 +00:00
return 0;
}
SAL_WNOUNREACHABLE_CODE_POP
void SAL_CALL OUser::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
2000-09-18 15:18:56 +00:00
{
::osl::MutexGuard aGuard(m_aMutex);
2001-05-14 10:42:44 +00:00
checkDisposed(OUser_BASE::rBHelper.bDisposed);
::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
2000-09-18 15:18:56 +00:00
}
void SAL_CALL OUser::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
2000-09-18 15:18:56 +00:00
{
::osl::MutexGuard aGuard(m_aMutex);
2001-05-14 10:42:44 +00:00
checkDisposed(OUser_BASE::rBHelper.bDisposed);
::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
2000-09-18 15:18:56 +00:00
}
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OUser::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
2001-04-30 08:59:56 +00:00
{
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
OUString SAL_CALL OUser::getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
2001-04-30 08:59:56 +00:00
{
return m_Name;
}
void SAL_CALL OUser::setName( const OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
2001-04-30 08:59:56 +00:00
{
OSL_FAIL( "OUser::setName: not implemented!" );
// not allowed to throw an SQLException here ...
2001-04-30 08:59:56 +00:00
}
2001-04-30 08:59:56 +00:00
// XInterface
2001-10-16 17:14:25 +00:00
void SAL_CALL OUser::acquire() throw()
2001-04-30 08:59:56 +00:00
{
OUser_BASE::acquire();
}
2001-10-16 17:14:25 +00:00
void SAL_CALL OUser::release() throw()
2001-04-30 08:59:56 +00:00
{
OUser_BASE::release();
}
2001-04-30 08:59:56 +00:00
2000-09-18 15:18:56 +00:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */