1 /* 2 * Copyright (c) 2002-2022, City of Paris 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright notice 10 * and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright notice 13 * and the following disclaimer in the documentation and/or other materials 14 * provided with the distribution. 15 * 16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 * 32 * License 1.0 33 */ 34 package fr.paris.lutece.portal.business.rbac; 35 36 import java.util.Collection; 37 38 /** 39 * Interface for RBAC DAO 40 */ 41 public interface IRBACDAO 42 { 43 /** 44 * Delete a record from the table 45 * 46 * @param nRBACId 47 * The id of RBAC object to delete 48 */ 49 void delete( int nRBACId ); 50 51 /** 52 * Remove all the entries of the given role key 53 * 54 * @param strRoleKey 55 * the role key of the entries to remove 56 */ 57 void deleteForRoleKey( String strRoleKey ); 58 59 /** 60 * Insert a new record in the table. 61 * 62 * 63 * @param rBAC 64 * The rBAC object 65 */ 66 void insert( RBAC rBAC ); 67 68 /** 69 * Load the data of RBAC from the table 70 * 71 * 72 * @param nRBACId 73 * The identifier of RBAC 74 * @return the instance of the RBAC 75 */ 76 RBAC load( int nRBACId ); 77 78 /** 79 * Load the list of rBACs 80 * 81 * @return The Collection of the RBACs 82 */ 83 Collection<RBAC> selectRBACList( ); 84 85 /** 86 * Find all the entries for a given role key 87 * 88 * @param strRoleKey 89 * the role key to search for 90 * @return A collection of rBACs 91 */ 92 Collection<RBAC> selectRBACListByRoleKey( String strRoleKey ); 93 94 /** 95 * Find all entries for a given collection of permissions and roles 96 * 97 * @param permissions 98 * the permissions collection 99 * @param roles 100 * the roles collection 101 * @return A collection of RBACs 102 */ 103 Collection<RBAC> selectByPermissionsAndRoles( Collection<String> permissions, Collection<String> roles ); 104 105 /** 106 * 107 * 108 * @param strTypeCode 109 * The type code 110 * @param strId 111 * the id 112 * @param strPermission 113 * th permission 114 * @return listRoleKeys 115 */ 116 Collection<String> selectRoleKeys( String strTypeCode, String strId, String strPermission ); 117 118 /** 119 * Update the record in the table 120 * 121 * @param rBAC 122 * The reference of rBAC 123 */ 124 void store( RBAC rBAC ); 125 126 /** 127 * Update the role key of all the entries of a given role key 128 * 129 * @param strOldRoleKey 130 * the role key to update 131 * @param strNewRoleKey 132 * the new role key 133 */ 134 void updateRoleKey( String strOldRoleKey, String strNewRoleKey ); 135 136 /** 137 * Remove all the entries of the given ressource type and ressource id 138 * 139 * @param strResourceType 140 * the resource type 141 * @param strResourceId 142 * the resource id 143 */ 144 public void deleteForResourceTypeAndId( String strResourceType, String strResourceId ); 145 146 }