LibreOffice
LibreOffice 4.2 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_OSL_SECURITY_HXX
21 #define INCLUDED_OSL_SECURITY_HXX
22 
23 #include <rtl/ustring.hxx>
24 #include <osl/security_decl.hxx>
25 
26 namespace osl
27 {
28 
30 {
32 }
33 
35 {
37 }
38 
40  const rtl::OUString& strPasswd)
41 {
43 
44  m_handle = 0;
45 
46  return (osl_loginUser( strName.pData, strPasswd.pData, &m_handle)
48 }
49 
51  const rtl::OUString& strPasswd,
52  const rtl::OUString& strFileServer )
53 {
55 
56  m_handle = NULL;
57 
58  return (osl_loginUserOnFileServer(strName.pData, strPasswd.pData, strFileServer.pData, &m_handle)
60 }
61 
63 {
64  return osl_getUserIdent( m_handle, &strIdent.pData );
65 }
66 
67 
69 {
70  return osl_getUserName( m_handle, &strName.pData );
71 }
72 
73 
74 inline sal_Bool Security::getHomeDir( rtl::OUString& strDirectory) const
75 {
76  return osl_getHomeDir(m_handle, &strDirectory.pData );
77 }
78 
79 
80 inline sal_Bool Security::getConfigDir( rtl::OUString& strDirectory ) const
81 {
82  return osl_getConfigDir( m_handle, &strDirectory.pData );
83 }
84 
86 {
88 }
89 
91 {
92  return m_handle;
93 }
94 
95 
96 }
97 
98 #endif // INCLUDED_OSL_SECURITY_HXX
99 
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
Security()
constructor
Definition: security.hxx:29
sal_Bool getUserName(rtl::OUString &strName) const
get the name of the logged in user.
Definition: security.hxx:68
SAL_DLLPUBLIC sal_Bool osl_isAdministrator(oslSecurity Security)
Query if the user who is denotes by this security has administrator rigths.
Definition: security.h:33
SAL_DLLPUBLIC sal_Bool osl_getConfigDir(oslSecurity Security, rtl_uString **strDirectory)
Get the directory for configuration data of the user of this security handle.
SAL_DLLPUBLIC sal_Bool osl_getUserName(oslSecurity Security, rtl_uString **strName)
Get the login name for the user of this security handle.
sal_Bool getUserIdent(rtl::OUString &strIdent) const
get the ident of the logged in user.
Definition: security.hxx:62
oslSecurity getHandle() const
Returns the underlying oslSecurity handle.
Definition: security.hxx:90
SAL_DLLPUBLIC oslSecurity osl_getCurrentSecurity(void)
Create a security handle for the current user.
sal_Bool getConfigDir(rtl::OUString &strDirectory) const
get the directory for configuration data of the logged in user.
Definition: security.hxx:80
sal_Bool getHomeDir(rtl::OUString &strDirectory) const
get the home directory of the logged in user.
Definition: security.hxx:74
SAL_DLLPUBLIC sal_Bool osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
Get the login ident for the user of this security handle.
unsigned char sal_Bool
Definition: types.h:46
sal_Bool logonUser(const rtl::OUString &strName, const rtl::OUString &strPasswd)
get the security information for one user.
Definition: security.hxx:39
SAL_DLLPUBLIC oslSecurityError osl_loginUser(rtl_uString *strUserName, rtl_uString *strPasswd, oslSecurity *pSecurity)
Deprecated API Create a security handle for the denoted user.
oslSecurity m_handle
Definition: security_decl.hxx:37
SAL_DLLPUBLIC void osl_freeSecurityHandle(oslSecurity Security)
Free the security handle, created by osl_loginUser or osl_getCurrentSecurity.
~Security()
destructor
Definition: security.hxx:34
void * oslSecurity
Process handle.
Definition: security.h:45
SAL_DLLPUBLIC sal_Bool osl_getHomeDir(oslSecurity Security, rtl_uString **strDirectory)
Get the home directory of the user of this security handle.
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_Bool isAdministrator() const
Query if the user who is logged inhas administrator rigths.
Definition: security.hxx:85