Update ooo320-m1
[ooovba.git] / sal / inc / osl / security_decl.hxx
blobc81abd9288fbc8d451cd696002fefafe7b09c492
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: security_decl.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _OSL_SECURITY_DECL_HXX_
32 #define _OSL_SECURITY_DECL_HXX_
34 #include <rtl/ustring.hxx>
35 # include <osl/security.h>
37 namespace osl
40 /** capsulate security informations for one user.
41 A object of this class is used to execute a process with the rights an
42 security options of a scecified user.
43 @see Process::executeProcess
45 class Security
47 protected:
48 oslSecurity m_handle;
50 public:
51 /// constructor
52 inline Security();
53 /// destructor
54 inline ~Security();
55 /** get the security information for one user.
56 The underlying operating system is asked for this information.
57 @param strName [in] denotes the name of the user
58 @param strPasswd [in] denotes the password of this user
59 @return True, if the specified user is known by the underlying operating system,
60 otherwise False
62 inline sal_Bool SAL_CALL logonUser(const ::rtl::OUString& strName,
63 const ::rtl::OUString& strPasswd);
64 /** get the security information for one user.
65 This method will try to login the user at the denoted file server.
66 If a network resource named \\server\username exists and this resource
67 could be connected by this user, the methos will return true and getHomeDir
68 will return \\server\username.
69 @param strName [in] denotes the name of the user
70 @param strPasswd [in] denotes the password of this user
71 @return True, if the specified user is known by file server and the
72 could be connected, otherwise False
74 inline sal_Bool SAL_CALL logonUser(const ::rtl::OUString & strName,
75 const ::rtl::OUString & strPasswd,
76 const ::rtl::OUString & strFileServer);
78 /** get the ident of the logged in user.
79 @param strName [out] is the buffer which returns the name
80 @param max [in] is the size of this buffer
81 @return True, if any user is successfuly logged in, otherwise False
83 inline sal_Bool SAL_CALL getUserIdent( ::rtl::OUString& strIdent) const;
85 /** get the name of the logged in user.
86 @param strName [out] is the buffer which returns the name
87 @param max [in] is the size of this buffer
88 @return True, if any user is successfuly logged in, otherwise False
90 inline sal_Bool SAL_CALL getUserName( ::rtl::OUString& strName) const;
92 /** get the home directory of the logged in user.
93 @param strDirectory [out] is the buffer which returns the directory name
94 @param max [in] is the size of this buffer
95 @return True, if any user is successfuly logged in, otherwise False
97 inline sal_Bool SAL_CALL getHomeDir( ::rtl::OUString& strDirectory) const;
99 /** get the directory for configuration data of the logged in user.
100 @param strDirectory [out] is the buffer which returns the directory name
101 @param max [in] is the size of this buffer
102 @return True, if any user is successfuly logged in, otherwise False
104 inline sal_Bool SAL_CALL getConfigDir( ::rtl::OUString & strDirectory) const;
106 /** Query if the user who is logged inhas administrator rigths.
107 @return True, if the user has administrator rights, otherwise false.
109 inline sal_Bool SAL_CALL isAdministrator() const;
111 /** Returns the underlying oslSecurity handle
113 inline oslSecurity getHandle() const;
119 #endif // _OSL_SECURITY_HXX_