Bump version to 6.4-15
[LibreOffice.git] / include / osl / security_decl.hxx
bloba0346a69c519c8d981b196d3562396e61de8908d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_OSL_SECURITY_DECL_HXX
21 #define INCLUDED_OSL_SECURITY_DECL_HXX
23 #include "rtl/ustring.hxx"
24 #include "osl/security.h"
26 namespace osl
29 /** Encapsulate security information for one user.
30 A object of this class is used to execute a process with the rights an
31 security options of a specified user.
32 @see Process::executeProcess
34 class Security
36 protected:
37 oslSecurity m_handle;
39 public:
40 inline Security();
41 inline ~Security();
43 /** get the security information for one user.
44 The underlying operating system is asked for this information.
46 @param[in] strName denotes the name of the user
47 @param[in] strPasswd denotes the password of this user
49 @retval True, if the specified user is known by the underlying operating system
50 @retval False unknown user
52 inline bool SAL_CALL logonUser(const rtl::OUString& strName,
53 const rtl::OUString& strPasswd);
55 /** get the security information for one user.
57 @verbatim
58 This method will try to login the user at the denoted file server.
59 If a network resource named \\server\username exists and this resource
60 could be connected by this user, the method will return true and getHomeDir
61 will return \\server\username.
62 @endverbatim
64 @param[in] strName denotes the name of the user
65 @param[in] strPasswd denotes the password of this user
66 @param[in] strFileServer denotes the file server to login to
68 @retval True if the specified user is known by the file server and they
69 could be connected
70 @retval False if the user is not known by the file server
72 inline bool SAL_CALL logonUser(const rtl::OUString & strName,
73 const rtl::OUString & strPasswd,
74 const rtl::OUString & strFileServer);
76 /** get the ident of the logged in user.
78 @param[out] strIdent is the OUString which returns the name
80 @retval True if any user is successfully logged in
81 @retval False no user logged in
83 inline bool SAL_CALL getUserIdent( rtl::OUString& strIdent) const;
85 /** get the name of the logged in user.
87 @param[out] strName is the OUString which returns the name
88 @param[in] bIncludeDomain Include the Domain name (like "ORG\username"). Affects Windows only.
89 This parameter is available since LibreOffice 5.2.
91 @retval True if any user is successfully logged in
92 @retval False if no user is logged in
94 inline bool SAL_CALL getUserName( rtl::OUString& strName, bool bIncludeDomain=true ) const;
96 /** get the home directory of the logged in user.
97 @param[out] strDirectory is the OUString which returns the directory name
99 @retval True if any user is successfully logged in
100 @retval False if user is not logged in
102 inline bool SAL_CALL getHomeDir( rtl::OUString& strDirectory) const;
104 /** get the directory for configuration data of the logged in user.
106 @param[out] strDirectory is the OUString which returns the directory name
108 @retval True if any user is successfully logged in
109 @retval False if user is not logged in
111 inline bool SAL_CALL getConfigDir( rtl::OUString & strDirectory) const;
113 /** Query if the user who is logged in has administrator rights.
115 @retval True if the user has administrator rights
116 @retval False if the user does not have admin rights
118 inline bool SAL_CALL isAdministrator() const;
120 /** Returns the underlying oslSecurity handle
122 inline oslSecurity getHandle() const;
127 #endif // INCLUDED_OSL_SECURITY_DECL_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */