AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
security.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 
4 #ifndef INCLUDED_OSL_SECURITY_HXX
5 #define INCLUDED_OSL_SECURITY_HXX
6 
7 #include "sal/config.h"
8 
9 #include <cstddef>
10 
11 #include "rtl/ustring.hxx"
12 #include "osl/security_decl.hxx"
13 
14 namespace osl
15 {
16 
18 {
20 }
21 
23 {
25 }
26 
27 inline bool Security::logonUser(const rtl::OUString& strName,
28  const rtl::OUString& strPasswd)
29 {
31 
32  m_handle = NULL;
33 
34  return (osl_loginUser( strName.pData, strPasswd.pData, &m_handle)
36 }
37 
38 inline bool Security::logonUser( const rtl::OUString& strName,
39  const rtl::OUString& strPasswd,
40  const rtl::OUString& strFileServer )
41 {
43 
44  m_handle = NULL;
45 
46  return (osl_loginUserOnFileServer(strName.pData, strPasswd.pData, strFileServer.pData, &m_handle)
48 }
49 
50 inline bool Security::getUserIdent( rtl::OUString& strIdent) const
51 {
52  return osl_getUserIdent( m_handle, &strIdent.pData );
53 }
54 
55 
56 inline bool Security::getUserName( rtl::OUString& strName, bool bIncludeDomain ) const
57 {
58  if (bIncludeDomain)
59  return osl_getUserName( m_handle, &strName.pData );
60  return osl_getShortUserName( m_handle, &strName.pData );
61 }
62 
63 
64 inline bool Security::getHomeDir( rtl::OUString& strDirectory) const
65 {
66  return osl_getHomeDir(m_handle, &strDirectory.pData );
67 }
68 
69 
70 inline bool Security::getConfigDir( rtl::OUString& strDirectory ) const
71 {
72  return osl_getConfigDir( m_handle, &strDirectory.pData );
73 }
74 
75 inline bool Security::isAdministrator() const
76 {
78 }
79 
81 {
82  return m_handle;
83 }
84 
85 
86 }
87 
88 #endif // INCLUDED_OSL_SECURITY_HXX
89 
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC sal_Bool osl_isAdministrator(oslSecurity Security)
Query if the user who is denotes by this security has administrator rights.
SAL_DLLPUBLIC sal_Bool osl_getHomeDir(oslSecurity Security, rtl_uString **strDirectory)
Get the home directory of the user of this security handle.
oslSecurity getHandle() const
Returns the underlying oslSecurity handle.
Definition: security.hxx:80
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:182
SAL_DLLPUBLIC oslSecurityError osl_loginUserOnFileServer(rtl_uString *strUserName, rtl_uString *strPasswd, rtl_uString *strFileServer, oslSecurity *pSecurity)
Create a security handle for the denoted user.
SAL_DLLPUBLIC sal_Bool osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
Get the login ident for the user of this security handle.
bool getUserName(rtl::OUString &strName, bool bIncludeDomain=true) const
get the name of the logged in user.
Definition: security.hxx:56
SAL_DLLPUBLIC oslSecurityError osl_loginUser(rtl_uString *strUserName, rtl_uString *strPasswd, oslSecurity *pSecurity)
Deprecated API Create a security handle for the denoted user.
bool getUserIdent(rtl::OUString &strIdent) const
get the ident of the logged in user.
Definition: security.hxx:50
oslSecurity m_handle
Definition: security_decl.hxx:21
~Security()
Definition: security.hxx:22
pData
Definition: ustring.hxx:334
SAL_DLLPUBLIC sal_Bool osl_getShortUserName(oslSecurity Security, rtl_uString **strName)
Get the login name for the user of this security handle, excluding the domain name on Windows...
SAL_DLLPUBLIC sal_Bool osl_getConfigDir(oslSecurity Security, rtl_uString **strDirectory)
Get the directory for configuration data of the user of this security handle.
void * oslSecurity
Process handle.
Definition: security.h:29
SAL_DLLPUBLIC void osl_freeSecurityHandle(oslSecurity Security)
Free the security handle, created by osl_loginUser or osl_getCurrentSecurity.
bool logonUser(const rtl::OUString &strName, const rtl::OUString &strPasswd)
get the security information for one user.
Definition: security.hxx:27
Security()
Definition: security.hxx:17
Definition: security.h:17
bool getConfigDir(rtl::OUString &strDirectory) const
get the directory for configuration data of the logged in user.
Definition: security.hxx:70
bool getHomeDir(rtl::OUString &strDirectory) const
get the home directory of the logged in user.
Definition: security.hxx:64
bool isAdministrator() const
Query if the user who is logged in has administrator rights.
Definition: security.hxx:75
SAL_DLLPUBLIC oslSecurity osl_getCurrentSecurity(void)
Create a security handle for the current user.
SAL_DLLPUBLIC sal_Bool osl_getUserName(oslSecurity Security, rtl_uString **strName)
Get the login name for the user of this security handle.