View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.uif.util;
17  
18  import java.util.List;
19  import java.util.Map;
20  
21  import org.kuali.rice.core.api.criteria.QueryByCriteria;
22  import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
23  import org.kuali.rice.core.api.exception.RiceIllegalStateException;
24  import org.kuali.rice.kim.api.common.assignee.Assignee;
25  import org.kuali.rice.kim.api.common.template.Template;
26  import org.kuali.rice.kim.api.common.template.TemplateQueryResults;
27  import org.kuali.rice.kim.api.permission.Permission;
28  import org.kuali.rice.kim.api.permission.PermissionQueryResults;
29  import org.kuali.rice.kim.api.permission.PermissionService;
30  
31  /**
32   * Mock permission support supporting UIF unit tests.
33   * 
34   * <p>
35   * All permission checks return true, and throws UnsupportedOperationException for all introspection
36   * or modification operations.
37   * </p>
38   * 
39   * @author Kuali Rice Team (rice.collab@kuali.org)
40   */
41  public class MockPermissionService implements PermissionService {
42  
43      /**
44       * @see org.kuali.rice.kim.api.permission.PermissionService#createPermission(org.kuali.rice.kim.api.permission.Permission)
45       */
46      @Override
47      public Permission createPermission(Permission permission) throws RiceIllegalArgumentException,
48              RiceIllegalStateException {
49          throw new UnsupportedOperationException();
50      }
51  
52      /**
53       * @see org.kuali.rice.kim.api.permission.PermissionService#updatePermission(org.kuali.rice.kim.api.permission.Permission)
54       */
55      @Override
56      public Permission updatePermission(Permission permission) throws RiceIllegalArgumentException,
57              RiceIllegalStateException {
58          throw new UnsupportedOperationException();
59      }
60  
61      /**
62       * @see org.kuali.rice.kim.api.permission.PermissionService#hasPermission(java.lang.String,
63       *      java.lang.String, java.lang.String)
64       */
65      @Override
66      public boolean hasPermission(String principalId, String namespaceCode, String permissionName)
67              throws RiceIllegalArgumentException {
68          return true;
69      }
70  
71      /**
72       * @see org.kuali.rice.kim.api.permission.PermissionService#isAuthorized(java.lang.String,
73       *      java.lang.String, java.lang.String, java.util.Map)
74       */
75      @Override
76      public boolean isAuthorized(String principalId, String namespaceCode, String permissionName,
77              Map<String, String> qualification) throws RiceIllegalArgumentException {
78          return true;
79      }
80  
81      /**
82       * @see org.kuali.rice.kim.api.permission.PermissionService#hasPermissionByTemplate(java.lang.String,
83       *      java.lang.String, java.lang.String, java.util.Map)
84       */
85      @Override
86      public boolean hasPermissionByTemplate(String principalId, String namespaceCode, String permissionTemplateName,
87              Map<String, String> permissionDetails) throws RiceIllegalArgumentException {
88          return true;
89      }
90  
91      /**
92       * @see org.kuali.rice.kim.api.permission.PermissionService#isAuthorizedByTemplate(java.lang.String,
93       *      java.lang.String, java.lang.String, java.util.Map, java.util.Map)
94       */
95      @Override
96      public boolean isAuthorizedByTemplate(String principalId, String namespaceCode, String permissionTemplateName,
97              Map<String, String> permissionDetails, Map<String, String> qualification)
98              throws RiceIllegalArgumentException {
99          return true;
100     }
101 
102     /**
103      * @see org.kuali.rice.kim.api.permission.PermissionService#getPermissionAssignees(java.lang.String,
104      *      java.lang.String, java.util.Map)
105      */
106     @Override
107     public List<Assignee> getPermissionAssignees(String namespaceCode, String permissionName,
108             Map<String, String> qualification) throws RiceIllegalArgumentException {
109         throw new UnsupportedOperationException();
110     }
111 
112     /**
113      * @see org.kuali.rice.kim.api.permission.PermissionService#getPermissionAssigneesByTemplate(java.lang.String,
114      *      java.lang.String, java.util.Map, java.util.Map)
115      */
116     @Override
117     public List<Assignee> getPermissionAssigneesByTemplate(String namespaceCode, String permissionTemplateName,
118             Map<String, String> permissionDetails, Map<String, String> qualification)
119             throws RiceIllegalArgumentException {
120         throw new UnsupportedOperationException();
121     }
122 
123     /**
124      * @see org.kuali.rice.kim.api.permission.PermissionService#isPermissionDefined(java.lang.String,
125      *      java.lang.String)
126      */
127     @Override
128     public boolean isPermissionDefined(String namespaceCode, String permissionName) throws RiceIllegalArgumentException {
129         return true;
130     }
131 
132     /**
133      * @see org.kuali.rice.kim.api.permission.PermissionService#isPermissionDefinedByTemplate(java.lang.String,
134      *      java.lang.String, java.util.Map)
135      */
136     @Override
137     public boolean isPermissionDefinedByTemplate(String namespaceCode, String permissionTemplateName,
138             Map<String, String> permissionDetails) throws RiceIllegalArgumentException {
139         return true;
140     }
141 
142     /**
143      * @see org.kuali.rice.kim.api.permission.PermissionService#getAuthorizedPermissions(java.lang.String,
144      *      java.lang.String, java.lang.String, java.util.Map)
145      */
146     @Override
147     public List<Permission> getAuthorizedPermissions(String principalId, String namespaceCode, String permissionName,
148             Map<String, String> qualification) throws RiceIllegalArgumentException {
149         throw new UnsupportedOperationException();
150     }
151 
152     /**
153      * @see org.kuali.rice.kim.api.permission.PermissionService#getAuthorizedPermissionsByTemplate(java.lang.String,
154      *      java.lang.String, java.lang.String, java.util.Map, java.util.Map)
155      */
156     @Override
157     public List<Permission> getAuthorizedPermissionsByTemplate(String principalId, String namespaceCode,
158             String permissionTemplateName, Map<String, String> permissionDetails, Map<String, String> qualification)
159             throws RiceIllegalArgumentException {
160         throw new UnsupportedOperationException();
161     }
162 
163     /**
164      * @see org.kuali.rice.kim.api.permission.PermissionService#getPermission(java.lang.String)
165      */
166     @Override
167     public Permission getPermission(String id) {
168         throw new UnsupportedOperationException();
169     }
170 
171     /**
172      * @see org.kuali.rice.kim.api.permission.PermissionService#findPermByNamespaceCodeAndName(java.lang.String,
173      *      java.lang.String)
174      */
175     @Override
176     public Permission findPermByNamespaceCodeAndName(String namespaceCode, String name)
177             throws RiceIllegalArgumentException {
178         throw new UnsupportedOperationException();
179     }
180 
181     /**
182      * @see org.kuali.rice.kim.api.permission.PermissionService#findPermissionsByTemplate(java.lang.String,
183      *      java.lang.String)
184      */
185     @Override
186     public List<Permission> findPermissionsByTemplate(String namespaceCode, String templateName)
187             throws RiceIllegalArgumentException {
188         throw new UnsupportedOperationException();
189     }
190 
191     /**
192      * @see org.kuali.rice.kim.api.permission.PermissionService#getPermissionTemplate(java.lang.String)
193      */
194     @Override
195     public Template getPermissionTemplate(String id) throws RiceIllegalArgumentException {
196         throw new UnsupportedOperationException();
197     }
198 
199     /**
200      * @see org.kuali.rice.kim.api.permission.PermissionService#findPermTemplateByNamespaceCodeAndName(java.lang.String,
201      *      java.lang.String)
202      */
203     @Override
204     public Template findPermTemplateByNamespaceCodeAndName(String namespaceCode, String name)
205             throws RiceIllegalArgumentException {
206         throw new UnsupportedOperationException();
207     }
208 
209     /**
210      * @see org.kuali.rice.kim.api.permission.PermissionService#getAllTemplates()
211      */
212     @Override
213     public List<Template> getAllTemplates() {
214         throw new UnsupportedOperationException();
215     }
216 
217     /**
218      * @see org.kuali.rice.kim.api.permission.PermissionService#getRoleIdsForPermission(java.lang.String,
219      *      java.lang.String)
220      */
221     @Override
222     public List<String> getRoleIdsForPermission(String namespaceCode, String permissionName)
223             throws RiceIllegalArgumentException {
224         throw new UnsupportedOperationException();
225     }
226 
227     /**
228      * @see org.kuali.rice.kim.api.permission.PermissionService#findPermissions(org.kuali.rice.core.api.criteria.QueryByCriteria)
229      */
230     @Override
231     public PermissionQueryResults findPermissions(QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException {
232         throw new UnsupportedOperationException();
233     }
234 
235     /**
236      * @see org.kuali.rice.kim.api.permission.PermissionService#findPermissionTemplates(org.kuali.rice.core.api.criteria.QueryByCriteria)
237      */
238     @Override
239     public TemplateQueryResults findPermissionTemplates(QueryByCriteria queryByCriteria)
240             throws RiceIllegalArgumentException {
241         throw new UnsupportedOperationException();
242     }
243 
244 }