1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: permissions.h,v $
10 * $Revision: 1.5.16.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _STOC_SEC_PERMISSIONS_H_
31 #define _STOC_SEC_PERMISSIONS_H_
33 #include <rtl/unload.h>
34 #include <rtl/ref.hxx>
35 #include <rtl/ustring.hxx>
36 #include <salhelper/simplereferenceobject.hxx>
38 #include <com/sun/star/uno/Any.hxx>
39 #include <com/sun/star/uno/Sequence.hxx>
40 #include <com/sun/star/uno/RuntimeException.hpp>
42 extern ::rtl_StandardModuleCount g_moduleCount
;
46 //==================================================================================================
47 class Permission
: public ::salhelper::SimpleReferenceObject
50 ::rtl::Reference
< Permission
> m_next
;
52 enum t_type
{ ALL
, RUNTIME
, SOCKET
, FILE } m_type
;
56 ::rtl::Reference
< Permission
> const & next
= ::rtl::Reference
< Permission
>() )
62 virtual bool implies( Permission
const & perm
) const SAL_THROW( () ) = 0;
63 virtual ::rtl::OUString
toString() const SAL_THROW( () ) = 0;
65 //==================================================================================================
66 class AllPermission
: public Permission
70 ::rtl::Reference
< Permission
> const & next
= ::rtl::Reference
< Permission
>() )
72 : Permission( ALL
, next
)
75 virtual bool implies( Permission
const & ) const SAL_THROW( () );
76 virtual ::rtl::OUString
toString() const SAL_THROW( () );
79 //==================================================================================================
80 class PermissionCollection
82 ::rtl::Reference
< Permission
> m_head
;
84 inline PermissionCollection() SAL_THROW( () )
86 inline PermissionCollection( PermissionCollection
const & collection
) SAL_THROW( () )
87 : m_head( collection
.m_head
)
89 inline PermissionCollection( ::rtl::Reference
< Permission
> const & single
) SAL_THROW( () )
93 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> const & permissions
,
94 PermissionCollection
const & addition
= PermissionCollection() )
95 SAL_THROW( (::com::sun::star::uno::RuntimeException
) );
97 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> toStrings() const SAL_THROW( () );
99 void checkPermission( ::com::sun::star::uno::Any
const & perm
) const
100 SAL_THROW( (::com::sun::star::uno::RuntimeException
) );