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