1 19 20 package com.sslexplorer.policyframework.itemactions; 21 22 import com.sslexplorer.policyframework.NoPermissionException; 23 import com.sslexplorer.policyframework.Permission; 24 import com.sslexplorer.policyframework.PolicyConstants; 25 import com.sslexplorer.policyframework.ResourceItem; 26 import com.sslexplorer.policyframework.ResourceUtil; 27 import com.sslexplorer.table.AvailableTableItemAction; 28 29 33 public class EditResourceAction extends AbstractPathAction { 34 36 public static final String TABLE_ITEM_ACTION_ID = "edit"; 37 38 43 public EditResourceAction(int navigationContext, String messageResourcesKey) { 44 this(navigationContext, messageResourcesKey, "{2}.do?actionTarget=edit&selectedResource={0}"); 45 } 46 47 52 public EditResourceAction(int navigationContext, String messageResourcesKey, String requiredPath) { 53 super(TABLE_ITEM_ACTION_ID, messageResourcesKey, 100, true, navigationContext, requiredPath); 54 } 55 56 60 public boolean isEnabled(AvailableTableItemAction availableItem) { 61 try { 62 ResourceItem item = (ResourceItem) availableItem.getRowItem(); 63 Permission[] permissions = new Permission[] { PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN, PolicyConstants.PERM_EDIT_AND_ASSIGN, PolicyConstants.PERM_ASSIGN }; 64 ResourceUtil.checkResourceManagementRights(item.getResource(), availableItem.getSessionInfo(), permissions); 65 return true; 66 } catch (NoPermissionException e) { 67 return false; 68 } 69 } 70 } | Popular Tags |