01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/content/tags/sakai_2-4-1/content-api/api/src/java/org/sakaiproject/content/api/CustomToolAction.java $
03: * $Id: CustomToolAction.java 20351 2007-01-17 00:03:51Z jimeng@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2007 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.content.api;
21:
22: import java.util.List;
23:
24: /**
25: * CustomToolAction must be implemented by every ResourceToolAction whose ActionType is
26: * ResourceToolAction.ActionType.CUSTOM_TOOL_ACTION. The interface defines a method
27: * to allow the Resources tool to query a helper to determine permissions for the action.
28: * If the permissions are determined entirely by content permissions corresponding to
29: * those defined for a common action in the Resources tool (such as create, revise,
30: * delete, duplicate, ...), it is better to define the action as an InteractiveAction
31: * or ServiceLevelAction with ActionType defined to match the action whose permissions
32: * it mimics. If custom permissions are required, the ResourceToolAction must be ot type
33: * CUSTOM_TOOL_ACTION, and its definition must implement this interface.
34: */
35: public interface CustomToolAction extends ResourceToolAction {
36: /**
37: * Determine whether the current user can perform this action on the resource.
38: *
39: * @param entityId The id of the resource.
40: * @param contentPermissions A list of the "content.*" permissions the current user has in the context of the resource.
41: * @param isCreator A flag indicating whether the user is the creator of the resource.
42: * @return true if the user can perform the action and false otherwise.
43: */
44: public boolean isAllowed(String entityId,
45: List<String> contentPermissions, boolean isCreator);
46:
47: }
|