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.tenancy; 020 021import org.apache.isis.extensions.secman.api.user.ApplicationUser; 022 023/** 024 * Optional SPI interface to be implemented by a domain service, providing an alternative mechanism for evaluating the 025 * application tenancy of the object being interacted with (the "what") and optionally also the tenancy of the user 026 * making the call (the "who"). 027 * 028 * @see #handles(Class) 029 */ 030public interface ApplicationTenancyEvaluator { 031 032 /** 033 * Whether this evaluator can determine the tenancy of the specified domain entity (such as <tt>ToDoItem</tt>) 034 * being interacted with (the "what"). 035 * 036 * <p> 037 * This method is also called to determine if the evaluator is also able to determine the tenancy of the 038 * security module's own {@link ApplicationUser}, ie the "who" is 039 * doing the interacting. If the evaluator does not handle the class, then the fallback behaviour is 040 * to invoke {@link ApplicationUser#getAtPath()}} on the {@link ApplicationUser} and use the 041 * path from that. 042 * </p> 043 */ 044 boolean handles(Class<?> cls); 045 046 String hides(Object domainObject, ApplicationUser applicationUser); 047 048 String disables(Object domainObject, ApplicationUser applicationUser); 049 050 051}