001 /* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at 010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE 011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE. 012 * See the License for the specific language governing permissions 013 * and limitations under the License. 014 * 015 * When distributing Covered Code, include this CDDL HEADER in each 016 * file and include the License file at 017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, 018 * add the following below this CDDL HEADER, with the fields enclosed 019 * by brackets "[]" replaced with your own identifying information: 020 * Portions Copyright [yyyy] [name of copyright owner] 021 * 022 * CDDL HEADER END 023 * 024 * 025 * Copyright 2008 Sun Microsystems, Inc. 026 */ 027 028 package org.opends.server.authorization.dseecompat; 029 030 import java.util.List; 031 032 import org.opends.server.core.*; 033 import org.opends.server.types.*; 034 import org.opends.server.workflowelement.localbackend.*; 035 036 /** 037 * The AciLDAPOperationContainer is an AciContainer 038 * extended class that wraps each LDAP operation being 039 * evaluated or tested for target matched of an ACI. 040 */ 041 public class AciLDAPOperationContainer extends AciContainer { 042 043 /* 044 * The entry to be returned if this is a LDAP search. 045 */ 046 private SearchResultEntry searchEntry; 047 048 /* 049 * The list of modifications if this operation is a LDAP 050 * modify. 051 */ 052 private List<Modification> modifications; 053 054 /** 055 * Constructor interface for the compare operation. 056 * @param operation The compare operation to evaluate. 057 * @param rights The rights of a compare operation. 058 */ 059 public AciLDAPOperationContainer(LocalBackendCompareOperation operation, 060 int rights) 061 { 062 super(operation, rights, operation.getEntryToCompare()); 063 } 064 065 /** 066 * Constructor interface for evaluation of a control. 067 * 068 * @param operation The operation to use in the evaluation. 069 * @param e An entry built especially for evaluation. 070 * @param c The control to evaluate. 071 * @param rights The rights of a control. 072 */ 073 public AciLDAPOperationContainer(Operation operation, Entry e, Control c, 074 int rights) { 075 super(operation, rights, e ); 076 setControlOID(c.getOID()); 077 } 078 079 /** 080 * Constructor interface for evaluation of the extended operation. 081 * 082 * @param operation The extended operation to evaluate. 083 * @param e An entry built especially for evaluation. 084 * @param rights The rights of a extended operation. 085 */ 086 public AciLDAPOperationContainer(ExtendedOperation operation, Entry e, 087 int rights) { 088 super(operation, rights, e ); 089 setExtOpOID(operation.getRequestOID()); 090 } 091 092 /** 093 * Constructor interface for the add operation. 094 * @param operation The add operation to evaluate. 095 * @param rights The rights of an add operation. 096 */ 097 public AciLDAPOperationContainer(LocalBackendAddOperation operation, 098 int rights) 099 { 100 super(operation, rights, operation.getEntryToAdd()); 101 } 102 103 /** 104 * Constructor interface for the delete operation. 105 * @param operation The add operation to evaluate. 106 * @param rights The rights of a delete operation. 107 */ 108 public AciLDAPOperationContainer(LocalBackendDeleteOperation operation, 109 int rights) { 110 super(operation, rights, operation.getEntryToDelete()); 111 } 112 113 /** 114 * Constructor interface for the modify operation. 115 * @param rights The rights of modify operation. 116 * @param operation The add operation to evaluate. 117 */ 118 public AciLDAPOperationContainer(LocalBackendModifyOperation operation, 119 int rights) 120 { 121 super(operation, rights, operation.getCurrentEntry()); 122 this.modifications=operation.getModifications(); 123 } 124 125 /** 126 * Constructor interface for the modify DN operation. 127 * @param operation The modify DN operation. 128 * @param rights The rights of the modify DN operation. 129 * @param entry The entry to evalauted for this modify DN. 130 */ 131 public AciLDAPOperationContainer(LocalBackendModifyDNOperation operation, 132 int rights, 133 Entry entry) { 134 super(operation, rights, entry); 135 } 136 137 /** 138 * Constructor interface for the LDAP search operation. 139 * @param operation The search operation. 140 * @param rights The rights of a search operation. 141 * @param entry The entry to be evaluated for this search. 142 */ 143 public AciLDAPOperationContainer(SearchOperation operation, 144 int rights, 145 SearchResultEntry entry) 146 { 147 super(operation, rights, entry); 148 this.searchEntry = entry; 149 } 150 151 /** 152 * Retrieve the search result entry of the search operation. 153 * @return The search result entry. 154 */ 155 public SearchResultEntry getSearchResultEntry() { 156 return this.searchEntry; 157 } 158 159 /** Retrieve the list of modifications if this is a LDAP modify. 160 * @return The list of LDAP modifications to made on the resource entry. 161 */ 162 public List<Modification> getModifications() { 163 return modifications; 164 } 165 }