Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef _CPPUHELPER_ACCESS_CONTROL_HXX_
20 : #define _CPPUHELPER_ACCESS_CONTROL_HXX_
21 :
22 : #include <com/sun/star/uno/XComponentContext.hpp>
23 : #include <com/sun/star/security/XAccessController.hpp>
24 : #include "cppuhelperdllapi.h"
25 :
26 :
27 : namespace cppu
28 : {
29 :
30 : /** Helper class retriving access controller singleton from component context.
31 : */
32 0 : class CPPUHELPER_DLLPUBLIC AccessControl
33 : {
34 : ::com::sun::star::uno::Reference< ::com::sun::star::security::XAccessController > m_xController;
35 :
36 : public:
37 : /** Ctor.
38 :
39 : @param xContext component context to retrieve access controller singleton
40 : */
41 : AccessControl(
42 : ::com::sun::star::uno::Reference<
43 : ::com::sun::star::uno::XComponentContext > const & xContext )
44 : SAL_THROW( (::com::sun::star::uno::RuntimeException) );
45 : /** Ctor.
46 :
47 : @param xController access controller
48 : */
49 : AccessControl(
50 : ::com::sun::star::uno::Reference<
51 : ::com::sun::star::security::XAccessController > const & xController )
52 : SAL_THROW( (::com::sun::star::uno::RuntimeException) );
53 : /** Copy ctor.
54 :
55 : @param ac another object
56 : */
57 : AccessControl( ::cppu::AccessControl const & ac )
58 : SAL_THROW( (::com::sun::star::uno::RuntimeException) );
59 :
60 : /** Clears the access controller reference being used.
61 : */
62 : inline void SAL_CALL clear() SAL_THROW(())
63 : { m_xController.clear(); }
64 :
65 : /** Returns access to the access controller reference being used.
66 :
67 : @return access controller
68 : */
69 : inline ::com::sun::star::uno::Reference<
70 : ::com::sun::star::security::XAccessController > const & SAL_CALL get() const SAL_THROW(())
71 : { return m_xController; }
72 :
73 : /** Returns access to the access controller reference being used.
74 :
75 : @return access controller
76 : */
77 : inline ::com::sun::star::security::XAccessController * SAL_CALL operator -> () const SAL_THROW(())
78 : { return m_xController.get(); }
79 :
80 :
81 : /** A com.sun.star.security.RuntimePermission is for runtime permissions.
82 : A RuntimePermission contains a name (also referred to as a "target name") but no
83 : actions list; you either have the named permission or you don't.
84 :
85 : @param name name of permission
86 : */
87 : void SAL_CALL checkRuntimePermission(
88 : ::rtl::OUString const & name )
89 : SAL_THROW( (::com::sun::star::uno::RuntimeException) );
90 :
91 : /** A com.sun.star.io.FilePermission represents access to a file or directory.
92 : A FilePermission consists of a file url and a set of actions valid for that pathname.
93 :
94 : @param url file url
95 : @param actions actions list
96 : */
97 : void SAL_CALL checkFilePermission(
98 : ::rtl::OUString const & url,
99 : ::rtl::OUString const & actions )
100 : SAL_THROW( (::com::sun::star::uno::RuntimeException) );
101 :
102 : /** A com.sun.star.connection.SocketPermission represents access to a network via sockets.
103 : A SocketPermission consists of a host specification and a set of "actions"
104 : specifying ways to connect to that host.
105 :
106 : @param host host and optional portrange
107 : @param actions actions list
108 : */
109 : void SAL_CALL checkSocketPermission(
110 : ::rtl::OUString const & host,
111 : ::rtl::OUString const & actions )
112 : SAL_THROW( (::com::sun::star::uno::RuntimeException) );
113 : };
114 :
115 : }
116 :
117 : #endif
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|