1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27#ifndef __com_sun_star_security_XAccessController_idl__ 28#define __com_sun_star_security_XAccessController_idl__ 29 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 36 37#ifndef __com_sun_star_security_XAction_idl__ 38#include <com/sun/star/security/XAction.idl> 39#endif 40 41#ifndef __com_sun_star_security_AccessControlException_idl__ 42#include <com/sun/star/security/AccessControlException.idl> 43#endif 44 45 46//============================================================================= 47 48module com { module sun { module star { module security { 49 50//============================================================================= 51 52/** Interface for checking permissions and invoking privileged or restricted 53 actions. 54 55 @since OOo 1.1.2 56*/ 57published interface XAccessController : com::sun::star::uno::XInterface 58{ 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> 70 71 @param perm 72 permission to be checked 73 74 @throws AccessControlException 75 thrown if access is denied 76 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 82 */ 83 void checkPermission( 84 [in] any perm ) 85 raises (AccessControlException); 86 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> 96 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 105 */ 106 any doRestricted( 107 [in] XAction action, 108 [in] XAccessControlContext restriction ) 109 raises (com::sun::star::uno::Exception); 110 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. 116 <p> 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> 120 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. 125 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 134 */ 135 any doPrivileged( 136 [in] XAction action, 137 [in] XAccessControlContext restriction ) 138 raises (com::sun::star::uno::Exception); 139 140 /** This method takes a "snapshot" of the current calling context 141 and returns it. 142 <p> 143 This context may then be checked at a later point, possibly in another thread. 144 </p> 145 @return 146 snapshot of context 147 */ 148 XAccessControlContext getContext(); 149}; 150 151//============================================================================= 152 153}; }; }; }; 154 155#endif 156