001/** 002 * Copyright 2005-2018 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.uif.view; 017 018import org.kuali.rice.krad.uif.container.CollectionGroup; 019import org.kuali.rice.krad.uif.container.Group; 020import org.kuali.rice.krad.uif.element.Action; 021import org.kuali.rice.krad.uif.field.Field; 022import org.kuali.rice.krad.uif.widget.Widget; 023import org.kuali.rice.krad.web.form.UifFormBase; 024 025import java.util.Set; 026 027/** 028 * Configured for a <code>View</code> instance to provide conditional authorization logic 029 * based on any variable (view configuration, system parameters, ...) that does 030 * not depend on the current user 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034public interface ViewPresentationController { 035 036 public Set<String> getActionFlags(View view, UifFormBase model); 037 038 public Set<String> getEditModes(View view, UifFormBase model); 039 040 /** 041 * Determines if the the given view and data is allowed to be edited 042 * 043 * @param view - view instance to check whether editing is allowed 044 * @param model - object containing the view data 045 * @return boolean true if editing on the view is allowed, false otherwise 046 */ 047 public boolean canEditView(View view, ViewModel model); 048 049 /** 050 * Determines if the given field within the view is allowed to be edited 051 * 052 * @param view - view instance the field belongs to 053 * @param model - object containing the view data 054 * @param field - field instance to determine edit authorization for 055 * @param propertyName - name of the property that field corresponds with (if field is data binding) 056 * @return boolean true if editing on the field is allowed, false otherwise 057 */ 058 public boolean canEditField(View view, ViewModel model, Field field, String propertyName); 059 060 /** 061 * Determines if the given field within the view is allowed to be viewed 062 * 063 * @param view - view instance the field belongs to 064 * @param model - object containing the view data 065 * @param field - field instance to determine view authorization for 066 * @param propertyName - name of the property that field corresponds with (if field is data binding) 067 * @return boolean true if viewing of the field is allowed, false otherwise 068 */ 069 public boolean canViewField(View view, ViewModel model, Field field, String propertyName); 070 071 /** 072 * Determines if a value is required to be present for the given field (used to indicate in the client the 073 * field must be completed) 074 * 075 * @param view - view instance the field belongs to 076 * @param model - object containing the view data 077 * @param field - field instance to determine required state for 078 * @param propertyName - name of the property that field corresponds with (if field is data binding) 079 * @return boolean true if field is required, false otherwise 080 */ 081 public boolean fieldIsRequired(View view, ViewModel model, Field field, String propertyName); 082 083 public boolean canEditGroup(View view, ViewModel model, Group group, String groupId); 084 085 public boolean canViewGroup(View view, ViewModel model, Group group, String groupId); 086 087 public boolean canEditWidget(View view, ViewModel model, Widget widget, String widgetId); 088 089 public boolean canViewWidget(View view, ViewModel model, Widget widget, String widgetId); 090 091 public boolean canPerformAction(View view, ViewModel model, Action action, String actionEvent, 092 String actionId); 093 094 public boolean canEditLine(View view, ViewModel model, CollectionGroup collectionGroup, 095 String collectionPropertyName, Object line); 096 097 public boolean canViewLine(View view, ViewModel model, CollectionGroup collectionGroup, 098 String collectionPropertyName, Object line); 099 100 public boolean canEditLineField(View view, ViewModel model, CollectionGroup collectionGroup, 101 String collectionPropertyName, Object line, Field field, String propertyName); 102 103 public boolean canViewLineField(View view, ViewModel model, CollectionGroup collectionGroup, 104 String collectionPropertyName, Object line, Field field, String propertyName); 105 106 public boolean canPerformLineAction(View view, ViewModel model, CollectionGroup collectionGroup, 107 String collectionPropertyName, Object line, Action action, String actionEvent, String actionId); 108 109 void setRequestAuthorizationCache(RequestAuthorizationCache requestAuthorizationCache); 110 111}