Branch libreoffice-5-0-4
[LibreOffice.git] / include / osl / security_decl.hxx
blob4e0ff268e5f293a60432464d40ad0aeae7a75de5
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 /** capsulate 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 scecified user.
32 @see Process::executeProcess
34 class Security
36 protected:
37 oslSecurity m_handle;
39 public:
40 /// constructor
41 inline Security();
42 /// destructor
43 inline ~Security();
44 /** get the security information for one user.
45 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
48 @return True, if the specified user is known by the underlying operating system,
49 otherwise False
51 inline bool SAL_CALL logonUser(const rtl::OUString& strName,
52 const rtl::OUString& strPasswd);
53 /** get the security information for one user.
55 @verbatim
56 This method will try to login the user at the denoted file server.
57 If a network resource named \\server\username exists and this resource
58 could be connected by this user, the methos will return true and getHomeDir
59 will return \\server\username.
60 @endverbatim
61 @param[in] strName denotes the name of the user
62 @param[in] strPasswd denotes the password of this user
63 @param[in] strFileServer denotes the file server to login to
64 @return True, if the specified user is known by file server and the
65 could be connected, otherwise False
67 inline bool SAL_CALL logonUser(const rtl::OUString & strName,
68 const rtl::OUString & strPasswd,
69 const rtl::OUString & strFileServer);
71 /** get the ident of the logged in user.
72 @param[out] strIdent is the OUString which returns the name
73 @return True, if any user is successfully logged in, otherwise False
75 inline bool SAL_CALL getUserIdent( rtl::OUString& strIdent) const;
77 /** get the name of the logged in user.
78 @param[out] strName is the OUString which returns the name
79 @return True, if any user is successfully logged in, otherwise False
81 inline bool SAL_CALL getUserName( rtl::OUString& strName) const;
83 /** get the home directory of the logged in user.
84 @param[out] strDirectory is the OUString which returns the directory name
85 @return True, if any user is successfully logged in, otherwise False
87 inline bool SAL_CALL getHomeDir( rtl::OUString& strDirectory) const;
89 /** get the directory for configuration data of the logged in user.
90 @param[out] strDirectory is the OUString which returns the directory name
91 @return True, if any user is successfully logged in, otherwise False
93 inline bool SAL_CALL getConfigDir( rtl::OUString & strDirectory) const;
95 /** Query if the user who is logged inhas administrator rights.
96 @return True, if the user has administrator rights, otherwise false.
98 inline bool SAL_CALL isAdministrator() const;
100 /** Returns the underlying oslSecurity handle
102 inline oslSecurity getHandle() const;
108 #endif // INCLUDED_OSL_SECURITY_DECL_HXX
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */