1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 * This file is part of LibreOffice published API.
24 #ifndef INCLUDED_OSL_SECURITY_DECL_HXX
25 #define INCLUDED_OSL_SECURITY_DECL_HXX
27 #include "rtl/ustring.hxx"
28 #include "osl/security.h"
33 /** Encapsulate security information for one user.
34 A object of this class is used to execute a process with the rights an
35 security options of a specified user.
36 @see Process::executeProcess
47 /** get the security information for one user.
48 The underlying operating system is asked for this information.
50 @param[in] strName denotes the name of the user
51 @param[in] strPasswd denotes the password of this user
53 @retval True, if the specified user is known by the underlying operating system
54 @retval False unknown user
56 inline bool SAL_CALL
logonUser(const rtl::OUString
& strName
,
57 const rtl::OUString
& strPasswd
);
59 /** get the security information for one user.
62 This method will try to login the user at the denoted file server.
63 If a network resource named \\server\username exists and this resource
64 could be connected by this user, the method will return true and getHomeDir
65 will return \\server\username.
68 @param[in] strName denotes the name of the user
69 @param[in] strPasswd denotes the password of this user
70 @param[in] strFileServer denotes the file server to login to
72 @retval True if the specified user is known by the file server and they
74 @retval False if the user is not known by the file server
76 inline bool SAL_CALL
logonUser(const rtl::OUString
& strName
,
77 const rtl::OUString
& strPasswd
,
78 const rtl::OUString
& strFileServer
);
80 /** get the ident of the logged in user.
82 @param[out] strIdent is the OUString which returns the name
84 @retval True if any user is successfully logged in
85 @retval False no user logged in
87 inline bool SAL_CALL
getUserIdent( rtl::OUString
& strIdent
) const;
89 /** get the name of the logged in user.
91 @param[out] strName is the OUString which returns the name
92 @param[in] bIncludeDomain Include the Domain name (like "ORG\username"). Affects Windows only.
93 This parameter is available since LibreOffice 5.2.
95 @retval True if any user is successfully logged in
96 @retval False if no user is logged in
98 inline bool SAL_CALL
getUserName( rtl::OUString
& strName
, bool bIncludeDomain
=true ) const;
100 /** get the home directory of the logged in user.
101 @param[out] strDirectory is the OUString which returns the directory name
103 @retval True if any user is successfully logged in
104 @retval False if user is not logged in
106 inline bool SAL_CALL
getHomeDir( rtl::OUString
& strDirectory
) const;
108 /** get the directory for configuration data of the logged in user.
110 @param[out] strDirectory is the OUString which returns the directory name
112 @retval True if any user is successfully logged in
113 @retval False if user is not logged in
115 inline bool SAL_CALL
getConfigDir( rtl::OUString
& strDirectory
) const;
117 /** Query if the user who is logged in has administrator rights.
119 @retval True if the user has administrator rights
120 @retval False if the user does not have admin rights
122 inline bool SAL_CALL
isAdministrator() const;
124 /** Returns the underlying oslSecurity handle
126 inline oslSecurity
getHandle() const;
131 #endif // INCLUDED_OSL_SECURITY_DECL_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */