001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.isis.extensions.secman.api.permission; 020 021import java.util.Collection; 022import java.util.Optional; 023 024import org.apache.isis.core.metamodel.services.appfeat.ApplicationFeatureId; 025import org.apache.isis.core.metamodel.services.appfeat.ApplicationFeatureType; 026import org.apache.isis.extensions.secman.api.role.ApplicationRole; 027 028public interface ApplicationPermissionRepository<P extends ApplicationPermission> { 029 030 Optional<P> findByUserAndPermissionValue(String username, ApplicationPermissionValue changingPermissionValue); 031 032 Optional<P> findByRoleAndRuleAndFeature( 033 ApplicationRole holder, 034 ApplicationPermissionRule rule, 035 ApplicationFeatureType type, 036 String featureFqn); 037 038 Collection<P> allPermissions(); 039 040 Collection<P> findOrphaned(); 041 Collection<P> findByFeatureCached(ApplicationFeatureId featureId); 042 Collection<P> findByRoleAndRuleAndFeatureTypeCached( 043 ApplicationRole holder, 044 ApplicationPermissionRule rule, 045 ApplicationFeatureType type); 046 047 048 /** 049 * @return detached entity 050 */ 051 P newApplicationPermission(); 052 053 P newPermission( 054 ApplicationRole role, 055 ApplicationPermissionRule rule, 056 ApplicationPermissionMode mode, 057 String packageFqn, 058 String className, 059 String memberName); 060 061 P newPermission( 062 ApplicationRole holder, 063 ApplicationPermissionRule rule, 064 ApplicationPermissionMode mode, 065 ApplicationFeatureType featureType, 066 String featureFqn); 067 068 069}