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 _STOC_SEC_PERMISSIONS_H_
20 : #define _STOC_SEC_PERMISSIONS_H_
21 :
22 : #include <rtl/unload.h>
23 : #include <rtl/ref.hxx>
24 : #include <rtl/ustring.hxx>
25 : #include <salhelper/simplereferenceobject.hxx>
26 :
27 : #include <com/sun/star/uno/Any.hxx>
28 : #include <com/sun/star/uno/Sequence.hxx>
29 : #include <com/sun/star/uno/RuntimeException.hpp>
30 :
31 : extern ::rtl_StandardModuleCount g_moduleCount;
32 :
33 : namespace stoc_sec
34 : {
35 : //==================================================================================================
36 0 : class Permission : public ::salhelper::SimpleReferenceObject
37 : {
38 : public:
39 : ::rtl::Reference< Permission > m_next;
40 : // mode
41 : enum t_type { ALL, RUNTIME, SOCKET, FILE } m_type;
42 :
43 0 : inline Permission(
44 : t_type type,
45 : ::rtl::Reference< Permission > const & next = ::rtl::Reference< Permission >() )
46 : SAL_THROW(())
47 : : m_next( next )
48 0 : , m_type( type )
49 0 : {}
50 :
51 : virtual bool implies( Permission const & perm ) const SAL_THROW(()) = 0;
52 : virtual ::rtl::OUString toString() const SAL_THROW(()) = 0;
53 : };
54 : //==================================================================================================
55 0 : class AllPermission : public Permission
56 : {
57 : public:
58 0 : inline AllPermission(
59 : ::rtl::Reference< Permission > const & next = ::rtl::Reference< Permission >() )
60 : SAL_THROW(())
61 0 : : Permission( ALL, next )
62 0 : {}
63 :
64 : virtual bool implies( Permission const & ) const SAL_THROW(());
65 : virtual ::rtl::OUString toString() const SAL_THROW(());
66 : };
67 :
68 : //==================================================================================================
69 0 : class PermissionCollection
70 : {
71 : ::rtl::Reference< Permission > m_head;
72 : public:
73 0 : inline PermissionCollection() SAL_THROW(())
74 0 : {}
75 0 : inline PermissionCollection( PermissionCollection const & collection ) SAL_THROW(())
76 0 : : m_head( collection.m_head )
77 0 : {}
78 0 : inline PermissionCollection( ::rtl::Reference< Permission > const & single ) SAL_THROW(())
79 0 : : m_head( single )
80 0 : {}
81 : PermissionCollection(
82 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const & permissions,
83 : PermissionCollection const & addition = PermissionCollection() )
84 : SAL_THROW( (::com::sun::star::uno::RuntimeException) );
85 : #ifdef __DIAGNOSE
86 : ::com::sun::star::uno::Sequence< ::rtl::OUString > toStrings() const SAL_THROW(());
87 : #endif
88 : void checkPermission( ::com::sun::star::uno::Any const & perm ) const
89 : SAL_THROW( (::com::sun::star::uno::RuntimeException) );
90 : };
91 :
92 : }
93 :
94 : #endif
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|