summaryrefslogtreecommitdiff
path: root/include/osl
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-03-07 21:52:20 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-03-08 15:35:54 +0000
commit16fb0d3d0f68708c183c53bd18660a23970b77fe (patch)
tree8e86df69dcf4ab52368a0a1d767dff62930549fd /include/osl
parentf9ddda353851b019c2eb8a427ee9f8042f8107b0 (diff)
tdf#98407 PathSubstitution: Add substitution for $(username)
This allows to use the username as a placeholder in the config paths (Autotext, Gallery, etc) Change-Id: I76434e980cd8ec8785a5587d0bc5fdd67dc42de2 Reviewed-on: https://gerrit.libreoffice.org/22901 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/osl')
-rw-r--r--include/osl/security.h10
-rw-r--r--include/osl/security.hxx6
-rw-r--r--include/osl/security_decl.hxx4
3 files changed, 17 insertions, 3 deletions
diff --git a/include/osl/security.h b/include/osl/security.h
index 2199f3abc6de..deefb5894047 100644
--- a/include/osl/security.h
+++ b/include/osl/security.h
@@ -118,6 +118,16 @@ SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getUserIdent(
SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getUserName(
oslSecurity Security, rtl_uString **strName);
+/** Get the login name for the user of this security handle,
+ excluding the domain name on Windows.
+ @param[in] Security the security handle.
+ @param[out] strName the string that receives the user name on success.
+ @return True, if the security handle is valid, otherwise False.
+ @since LibreOffice 5.2
+*/
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getShortUserName(
+ oslSecurity Security, rtl_uString **strName);
+
/** Get the home directory of the user of this security handle.
@param[in] Security the security handle.
@param[out] strDirectory the string that receives the directory path on success.
diff --git a/include/osl/security.hxx b/include/osl/security.hxx
index 57ab17de4c46..a1a905ee888a 100644
--- a/include/osl/security.hxx
+++ b/include/osl/security.hxx
@@ -69,9 +69,11 @@ inline bool Security::getUserIdent( rtl::OUString& strIdent) const
}
-inline bool Security::getUserName( rtl::OUString& strName ) const
+inline bool Security::getUserName( rtl::OUString& strName, bool bIncludeDomain ) const
{
- return osl_getUserName( m_handle, &strName.pData );
+ if (bIncludeDomain)
+ return osl_getUserName( m_handle, &strName.pData );
+ return osl_getShortUserName( m_handle, &strName.pData );
}
diff --git a/include/osl/security_decl.hxx b/include/osl/security_decl.hxx
index 6eb0a01da90e..a809f06698bd 100644
--- a/include/osl/security_decl.hxx
+++ b/include/osl/security_decl.hxx
@@ -76,9 +76,11 @@ public:
/** get the name of the logged in user.
@param[out] strName is the OUString which returns the name
+ @param[in] bIncludeDomain Include the Domain name (like "ORG\username"). Affects Windows only.
+ This parameter is available since LibreOffice 5.2.
@return True, if any user is successfully logged in, otherwise False
*/
- inline bool SAL_CALL getUserName( rtl::OUString& strName) const;
+ inline bool SAL_CALL getUserName( rtl::OUString& strName, bool bIncludeDomain=true ) const;
/** get the home directory of the logged in user.
@param[out] strDirectory is the OUString which returns the directory name