merge the formfield patch from ooo-build
[ooovba.git] / sal / inc / osl / security.h
blob5270811d0bcb93bee8f7c7c35a1079dd1a306b51
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.h,v $
10 * $Revision: 1.6 $
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_H_
32 #define _OSL_SECURITY_H_
34 #include <rtl/ustring.h>
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 typedef enum {
41 osl_Security_E_None,
42 osl_Security_E_UserUnknown,
43 osl_Security_E_WrongPassword,
44 osl_Security_E_Unknown,
45 osl_Security_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
46 } oslSecurityError;
48 /** Process handle
49 @see osl_loginUser
50 @see osl_freeSecurityHandle
51 @see osl_executeProcess
53 typedef void* oslSecurity;
55 /** Create a security handle for the current user.
56 @return a security handle or NULL on failure.
57 @see osl_freeSecurityHandle
58 @see osl_executeProcess
59 @see osl_executeApplication
61 oslSecurity SAL_CALL osl_getCurrentSecurity(void);
63 /** Create a security handle for the denoted user.
64 Try to log in the user on the local system.
65 @param strzUserName [in] denotes the name of the user to logg in.
66 @param strPasswd [in] the password for this user.
67 @param pSecurity [out] returns the security handle if user could be logged in.
68 @return osl_Security_E_None if user could be logged in, otherwise an error-code.
69 @see osl_freeSecurityHandle
70 @see osl_executeProcess
71 @see osl_executeApplication
73 oslSecurityError SAL_CALL osl_loginUser(
74 rtl_uString *strUserName,
75 rtl_uString *strPasswd,
76 oslSecurity *pSecurity
79 /** Create a security handle for the denoted user.
80 Try to log in the user on the denoted file server. On success the homedir will be
81 the maped drive on this server.
82 @param strUserName [in] denotes the name of the user to logg in.
83 @param strPasswd [in] the password for this user.
84 @param strFileServer [in] denotes the file server on wich the user is logged in.
85 @param pSecurity [out] returns the security handle if user could be logged in.
86 @return osl_Security_E_None if user could be logged in, otherwise an error-code.
87 @see osl_freeSecurityHandle
88 @see osl_executeProcess
89 @see osl_executeApplication
91 oslSecurityError SAL_CALL osl_loginUserOnFileServer(
92 rtl_uString *strUserName,
93 rtl_uString *strPasswd,
94 rtl_uString *strFileServer,
95 oslSecurity *pSecurity
98 /** Query if the user who is denotes by this security has administrator rigths.
99 @param Security [in] the security handle for th user.
100 @return True, if the user has adminsitrator rights, otherwise false.
102 sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security);
104 /** Free the security handle, created by osl_loginUser or osl_getCurrentSecurity.
105 @param Security [in] the security handle.
106 @see osl_loginUser
108 void SAL_CALL osl_freeSecurityHandle(oslSecurity Security);
110 /** Get the login ident for the user of this security handle.
111 @param Security [in] the security handle.
112 @param strIdent [out] the string that receives the ident on success.
113 @return True, if the security handle is valid, otherwise False.
115 sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent);
117 /** Get the login name for the user of this security handle.
118 @param Security [in] the security handle.
119 @param pszName [out] the string that receives the user name on success.
120 @return True, if the security handle is valid, otherwise False.
122 sal_Bool SAL_CALL osl_getUserName(oslSecurity Security, rtl_uString **strName);
124 /** Get the home directory of the user of this security handle.
125 @param Security [in] the security handle.
126 @param strDirectory [out] the string that receives the directory path on success.
127 @return True, if the security handle is valid, otherwise False.
129 sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **strDirectory);
131 /** Get the directory for configuration data of the user of this security handle.
132 @param Security [in] the security handle.
133 @param strDirectory [out] the string that receives the directory path on success.
134 @return True, if the security handle is valid, otherwise False.
136 sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **strDirectory);
139 /** Load Profile of the User
140 Implemented just for Windows
141 @param oslSecurity Security [in] previously fetch Security of the User
142 @return True if the Profile could successfully loaded, False otherwise.
145 sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security);
148 /** Unload a User Profile
149 Implemented just for Windows
150 @param oslSecurity Security [in] previously fetch Security of the User
151 @return nothing is returned!
154 void SAL_CALL osl_unloadUserProfile(oslSecurity Security);
156 #ifdef __cplusplus
158 #endif
160 #endif /* _OSL_SECURITY_H_ */