Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / cppuhelper / access_control.hxx
blob9158c8e0a783eb70e251c41f7a2f7435f6745a48
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 .
19 #ifndef INCLUDED_CPPUHELPER_ACCESS_CONTROL_HXX
20 #define INCLUDED_CPPUHELPER_ACCESS_CONTROL_HXX
22 #include <com/sun/star/uno/XComponentContext.hpp>
23 #include <com/sun/star/security/XAccessController.hpp>
24 #include <cppuhelper/cppuhelperdllapi.h>
27 namespace cppu
30 /** Helper class for retrieving access controller singleton from component context.
32 class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC AccessControl
34 css::uno::Reference< css::security::XAccessController > m_xController;
36 public:
37 /** Ctor.
39 @param xContext component context to retrieve access controller singleton
41 AccessControl(
42 css::uno::Reference< css::uno::XComponentContext > const & xContext );
43 /** Ctor.
45 @param xController access controller
47 AccessControl(
48 css::uno::Reference< css::security::XAccessController > const & xController );
49 /** Copy ctor.
51 @param ac another object
53 AccessControl( ::cppu::AccessControl const & ac );
55 /** Clears the access controller reference being used.
57 void SAL_CALL clear()
58 { m_xController.clear(); }
60 /** Returns access to the access controller reference being used.
62 @return access controller
64 css::uno::Reference< css::security::XAccessController > const & SAL_CALL get() const
65 { return m_xController; }
67 /** Returns access to the access controller reference being used.
69 @return access controller
71 css::security::XAccessController * SAL_CALL operator -> () const
72 { return m_xController.get(); }
75 /** A com.sun.star.security.RuntimePermission is for runtime permissions.
76 A RuntimePermission contains a name (also referred to as a "target name") but no
77 actions list; you either have the named permission or you don't.
79 @param name name of permission
81 void SAL_CALL checkRuntimePermission(
82 ::rtl::OUString const & name );
84 /** A com.sun.star.io.FilePermission represents access to a file or directory.
85 A FilePermission consists of a file url and a set of actions valid for that pathname.
87 @param url file url
88 @param actions actions list
90 void SAL_CALL checkFilePermission(
91 ::rtl::OUString const & url,
92 ::rtl::OUString const & actions );
94 /** A com.sun.star.connection.SocketPermission represents access to a network via sockets.
95 A SocketPermission consists of a host specification and a set of "actions"
96 specifying ways to connect to that host.
98 @param host host and optional portrange
99 @param actions actions list
101 void SAL_CALL checkSocketPermission(
102 ::rtl::OUString const & host,
103 ::rtl::OUString const & actions );
108 #endif
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */