2010-10-14 08:30:07 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-19 19:45:04 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-03-14 15:28:31 +00:00
|
|
|
|
2013-10-23 19:17:28 +02:00
|
|
|
#ifndef INCLUDED_OSL_SECURITY_DECL_HXX
|
|
|
|
#define INCLUDED_OSL_SECURITY_DECL_HXX
|
2001-03-14 15:28:31 +00:00
|
|
|
|
2017-10-23 22:22:50 +02:00
|
|
|
#include "rtl/ustring.hxx"
|
|
|
|
#include "osl/security.h"
|
2001-03-14 15:28:31 +00:00
|
|
|
|
|
|
|
namespace osl
|
|
|
|
{
|
|
|
|
|
2017-03-17 21:59:50 +11:00
|
|
|
/** Encapsulate security information for one user.
|
2001-03-14 15:28:31 +00:00
|
|
|
A object of this class is used to execute a process with the rights an
|
2017-03-24 11:42:19 +01:00
|
|
|
security options of a specified user.
|
2001-03-14 15:28:31 +00:00
|
|
|
@see Process::executeProcess
|
|
|
|
*/
|
|
|
|
class Security
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
oslSecurity m_handle;
|
|
|
|
|
|
|
|
public:
|
|
|
|
inline Security();
|
|
|
|
inline ~Security();
|
2017-03-18 03:12:05 +11:00
|
|
|
|
2001-03-14 15:28:31 +00:00
|
|
|
/** get the security information for one user.
|
|
|
|
The underlying operating system is asked for this information.
|
2017-06-23 06:08:00 +10:00
|
|
|
|
2012-01-19 20:18:48 -06:00
|
|
|
@param[in] strName denotes the name of the user
|
|
|
|
@param[in] strPasswd denotes the password of this user
|
2017-06-23 06:08:00 +10:00
|
|
|
|
2017-03-17 21:59:50 +11:00
|
|
|
@retval True, if the specified user is known by the underlying operating system
|
|
|
|
@retval False unknown user
|
2001-03-14 15:28:31 +00:00
|
|
|
*/
|
2014-01-27 10:45:55 +01:00
|
|
|
inline bool SAL_CALL logonUser(const rtl::OUString& strName,
|
2012-01-05 19:40:38 +01:00
|
|
|
const rtl::OUString& strPasswd);
|
2017-03-18 03:12:05 +11:00
|
|
|
|
2001-03-14 15:28:31 +00:00
|
|
|
/** get the security information for one user.
|
2013-03-18 21:55:24 -04:00
|
|
|
|
|
|
|
@verbatim
|
2001-03-14 15:28:31 +00:00
|
|
|
This method will try to login the user at the denoted file server.
|
|
|
|
If a network resource named \\server\username exists and this resource
|
2017-08-17 16:41:20 +02:00
|
|
|
could be connected by this user, the method will return true and getHomeDir
|
2001-03-14 15:28:31 +00:00
|
|
|
will return \\server\username.
|
2013-03-18 21:55:24 -04:00
|
|
|
@endverbatim
|
2017-03-18 03:12:05 +11:00
|
|
|
|
2012-01-19 20:18:48 -06:00
|
|
|
@param[in] strName denotes the name of the user
|
|
|
|
@param[in] strPasswd denotes the password of this user
|
2013-03-18 21:55:24 -04:00
|
|
|
@param[in] strFileServer denotes the file server to login to
|
2017-03-17 21:59:50 +11:00
|
|
|
|
|
|
|
@retval True if the specified user is known by the file server and they
|
2017-06-23 06:08:00 +10:00
|
|
|
could be connected
|
2017-03-17 21:59:50 +11:00
|
|
|
@retval False if the user is not known by the file server
|
2001-03-14 15:28:31 +00:00
|
|
|
*/
|
2014-01-27 10:45:55 +01:00
|
|
|
inline bool SAL_CALL logonUser(const rtl::OUString & strName,
|
2012-01-05 19:40:38 +01:00
|
|
|
const rtl::OUString & strPasswd,
|
|
|
|
const rtl::OUString & strFileServer);
|
2001-03-14 15:28:31 +00:00
|
|
|
|
|
|
|
/** get the ident of the logged in user.
|
2017-06-23 06:08:00 +10:00
|
|
|
|
2012-02-22 00:50:56 +01:00
|
|
|
@param[out] strIdent is the OUString which returns the name
|
2017-03-17 21:59:50 +11:00
|
|
|
|
|
|
|
@retval True if any user is successfully logged in
|
|
|
|
@retval False no user logged in
|
2001-03-14 15:28:31 +00:00
|
|
|
*/
|
2014-01-27 10:45:55 +01:00
|
|
|
inline bool SAL_CALL getUserIdent( rtl::OUString& strIdent) const;
|
2001-03-14 15:28:31 +00:00
|
|
|
|
|
|
|
/** get the name of the logged in user.
|
2017-06-23 06:08:00 +10:00
|
|
|
|
2012-01-19 20:18:48 -06:00
|
|
|
@param[out] strName is the OUString which returns the name
|
2016-03-07 21:52:20 +01:00
|
|
|
@param[in] bIncludeDomain Include the Domain name (like "ORG\username"). Affects Windows only.
|
|
|
|
This parameter is available since LibreOffice 5.2.
|
2017-03-17 21:59:50 +11:00
|
|
|
|
|
|
|
@retval True if any user is successfully logged in
|
|
|
|
@retval False if no user is logged in
|
2001-03-14 15:28:31 +00:00
|
|
|
*/
|
2016-03-07 21:52:20 +01:00
|
|
|
inline bool SAL_CALL getUserName( rtl::OUString& strName, bool bIncludeDomain=true ) const;
|
2001-03-14 15:28:31 +00:00
|
|
|
|
|
|
|
/** get the home directory of the logged in user.
|
2012-01-19 20:18:48 -06:00
|
|
|
@param[out] strDirectory is the OUString which returns the directory name
|
2017-03-17 21:59:50 +11:00
|
|
|
|
|
|
|
@retval True if any user is successfully logged in
|
|
|
|
@retval False if user is not logged in
|
2001-03-14 15:28:31 +00:00
|
|
|
*/
|
2014-01-27 10:45:55 +01:00
|
|
|
inline bool SAL_CALL getHomeDir( rtl::OUString& strDirectory) const;
|
2001-03-14 15:28:31 +00:00
|
|
|
|
|
|
|
/** get the directory for configuration data of the logged in user.
|
2017-06-23 06:08:00 +10:00
|
|
|
|
2012-01-19 20:18:48 -06:00
|
|
|
@param[out] strDirectory is the OUString which returns the directory name
|
2017-03-17 21:59:50 +11:00
|
|
|
|
|
|
|
@retval True if any user is successfully logged in
|
|
|
|
@retval False if user is not logged in
|
2001-03-14 15:28:31 +00:00
|
|
|
*/
|
2014-01-27 10:45:55 +01:00
|
|
|
inline bool SAL_CALL getConfigDir( rtl::OUString & strDirectory) const;
|
2001-03-14 15:28:31 +00:00
|
|
|
|
2015-07-02 18:23:08 +02:00
|
|
|
/** Query if the user who is logged in has administrator rights.
|
2017-06-23 06:08:00 +10:00
|
|
|
|
2017-03-17 21:59:50 +11:00
|
|
|
@retval True if the user has administrator rights
|
|
|
|
@retval False if the user does not have admin rights
|
2001-03-14 15:28:31 +00:00
|
|
|
*/
|
2014-01-27 10:45:55 +01:00
|
|
|
inline bool SAL_CALL isAdministrator() const;
|
2001-03-14 15:28:31 +00:00
|
|
|
|
|
|
|
/** Returns the underlying oslSecurity handle
|
|
|
|
*/
|
|
|
|
inline oslSecurity getHandle() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-10-23 19:17:28 +02:00
|
|
|
#endif // INCLUDED_OSL_SECURITY_DECL_HXX
|
2001-03-14 15:28:31 +00:00
|
|
|
|
2010-10-14 08:30:07 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|