1 4 package com.sslexplorer.policyframework.itemactions; 5 6 import com.sslexplorer.policyframework.NoPermissionException; 7 import com.sslexplorer.policyframework.Permission; 8 import com.sslexplorer.policyframework.PolicyConstants; 9 import com.sslexplorer.policyframework.ResourceItem; 10 import com.sslexplorer.policyframework.ResourceUtil; 11 import com.sslexplorer.table.AvailableTableItemAction; 12 13 15 public class RemoveResourceAction extends AbstractPathAction { 16 18 public static final String TABLE_ITEM_ACTION_ID = "remove"; 19 20 24 public RemoveResourceAction(int navigationContext, String messageResourcesKey) { 25 this(navigationContext, messageResourcesKey, "{2}.do?actionTarget=confirmRemove&selectedResource={0}"); 26 } 27 28 33 public RemoveResourceAction(int navigationContext, String messageResourcesKey, String requiredPath) { 34 super(TABLE_ITEM_ACTION_ID, messageResourcesKey, 200, true, navigationContext, requiredPath); 35 } 36 37 40 public boolean isEnabled(AvailableTableItemAction availableItem) { 41 try { 42 ResourceItem item = (ResourceItem) availableItem.getRowItem(); 43 Permission[] permissions = new Permission[] { PolicyConstants.PERM_DELETE }; 44 ResourceUtil.checkResourceManagementRights(item.getResource(), availableItem.getSessionInfo(), permissions); 45 return true; 46 } catch (NoPermissionException e) { 47 return false; 48 } 49 } 50 } | Popular Tags |