merged tag ooo/OOO330_m14
[LibreOffice.git] / udkapi / com / sun / star / security / XAccessController.idl
blob708a884bad68d804883678878f97ce2b18783e44
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef __com_sun_star_security_XAccessController_idl__
28 #define __com_sun_star_security_XAccessController_idl__
30 #ifndef __com_sun_star_uno_XInterface_idl__
31 #include <com/sun/star/uno/XInterface.idl>
32 #endif
33 #ifndef __com_sun_star_security_XAccessControlContext_idl__
34 #include <com/sun/star/security/XAccessControlContext.idl>
35 #endif
37 #ifndef __com_sun_star_security_XAction_idl__
38 #include <com/sun/star/security/XAction.idl>
39 #endif
41 #ifndef __com_sun_star_security_AccessControlException_idl__
42 #include <com/sun/star/security/AccessControlException.idl>
43 #endif
46 //=============================================================================
48 module com { module sun { module star { module security {
50 //=============================================================================
52 /** Interface for checking permissions and invoking privileged or restricted
53 actions.
55 @since OOo 1.1.2
57 published interface XAccessController : com::sun::star::uno::XInterface
59 /** Determines whether the access request indicated by the specified
60 permission should be allowed or denied, based on the security policy
61 currently in effect.
62 The semantics are equivalent to the security permission classes of
63 the Java platform.
64 <p>
65 You can also pass a sequence of permissions (sequence< any >) to check
66 a set of permissions, e.g. for performance reasons.
67 This method quietly returns if the access request is permitted,
68 or throws a suitable AccessControlException otherwise.
69 </p>
71 @param perm
72 permission to be checked
74 @throws AccessControlException
75 thrown if access is denied
77 @see ::com::sun::star::security::AccessControlException
78 @see ::com::sun::star::security::AllPermission
79 @see ::com::sun::star::security::RuntimePermission
80 @see ::com::sun::star::io::FilePermission
81 @see ::com::sun::star::connection::SocketPermission
83 void checkPermission(
84 [in] any perm )
85 raises (AccessControlException);
87 /** Perform the specified action restricting permissions to the given
88 XAccessControlContext.
89 The action is performed with the intersection of the permissions of the currently installed
90 XAccessControlContext, the given XAccessControlContext and the security policy currently
91 in effect. The latter includes static security, e.g. based on user credentials.
92 <p>
93 If the specified XAccessControlContext is null, then the action is performed
94 with unmodified permissions, i.e. the call makes no sense.
95 </p>
97 @param action
98 action object to be executed
99 @param restriction
100 access control context to restrict permission; null for no restriction
101 @return
102 result
103 @throws com::sun::star::uno::Exception
104 any UNO exception may be thrown
106 any doRestricted(
107 [in] XAction action,
108 [in] XAccessControlContext restriction )
109 raises (com::sun::star::uno::Exception);
111 /** Perform the specified action adding a set of permissions defined by the given
112 XAccessControlContext.
113 The action is performed with the union of the permissions of the currently installed
114 XAccessControlContext, the given XAccessControlContext and the security policy currently
115 in effect. The latter includes static security, e.g. based on user credentials.
117 If the given XAccessControlContext is null, then the action is performed
118 <b>only</b> with the permissions of the security policy currently in effect.
119 </p>
121 @attention
122 Do carefully use this method only for well known use-cases to avoid exploits!
123 Script engines executing sandboxed scripts should generally deny calling this
124 method.
126 @param action
127 action object to be executed
128 @param restriction
129 access control context to restrict permission; null for no restriction
130 @return
131 result
132 @throws com::sun::star::uno::Exception
133 any UNO exception may be thrown
135 any doPrivileged(
136 [in] XAction action,
137 [in] XAccessControlContext restriction )
138 raises (com::sun::star::uno::Exception);
140 /** This method takes a "snapshot" of the current calling context
141 and returns it.
143 This context may then be checked at a later point, possibly in another thread.
144 </p>
145 @return
146 snapshot of context
148 XAccessControlContext getContext();
151 //=============================================================================
153 }; }; }; };
155 #endif