00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _OSL_SECURITY_HXX_
00021 #define _OSL_SECURITY_HXX_
00022
00023 #include <rtl/ustring.hxx>
00024
00025 #ifndef _OSL_SECURITY_DECL_HXX
00026 # include <osl/security_decl.hxx>
00027 #endif
00028
00029 namespace osl
00030 {
00031
00032 inline Security::Security()
00033 {
00034 m_handle = osl_getCurrentSecurity();
00035 }
00036
00037 inline Security::~Security()
00038 {
00039 osl_freeSecurityHandle(m_handle);
00040 }
00041
00042 inline sal_Bool Security::logonUser(const rtl::OUString& strName,
00043 const rtl::OUString& strPasswd)
00044 {
00045 osl_freeSecurityHandle(m_handle);
00046
00047 m_handle = 0;
00048
00049 return (osl_loginUser( strName.pData, strPasswd.pData, &m_handle)
00050 == osl_Security_E_None);
00051 }
00052
00053 inline sal_Bool Security::logonUser( const rtl::OUString& strName,
00054 const rtl::OUString& strPasswd,
00055 const rtl::OUString& strFileServer )
00056 {
00057 osl_freeSecurityHandle(m_handle);
00058
00059 m_handle = NULL;
00060
00061 return (osl_loginUserOnFileServer(strName.pData, strPasswd.pData, strFileServer.pData, &m_handle)
00062 == osl_Security_E_None);
00063 }
00064
00065 inline sal_Bool Security::getUserIdent( rtl::OUString& strIdent) const
00066 {
00067 return osl_getUserIdent( m_handle, &strIdent.pData );
00068 }
00069
00070
00071 inline sal_Bool Security::getUserName( rtl::OUString& strName ) const
00072 {
00073 return osl_getUserName( m_handle, &strName.pData );
00074 }
00075
00076
00077 inline sal_Bool Security::getHomeDir( rtl::OUString& strDirectory) const
00078 {
00079 return osl_getHomeDir(m_handle, &strDirectory.pData );
00080 }
00081
00082
00083 inline sal_Bool Security::getConfigDir( rtl::OUString& strDirectory ) const
00084 {
00085 return osl_getConfigDir( m_handle, &strDirectory.pData );
00086 }
00087
00088 inline sal_Bool Security::isAdministrator() const
00089 {
00090 return osl_isAdministrator(m_handle);
00091 }
00092
00093 inline oslSecurity Security::getHandle() const
00094 {
00095 return m_handle;
00096 }
00097
00098
00099 }
00100
00101 #endif // _OSL_SECURITY_HXX_
00102
00103