コード例 #1
0
ファイル: Utils.java プロジェクト: canhpv/ecms
 /**
  * Check if the user can delete the current node
  *
  * @return true, if current mode is edit mode
  * @throws RepositoryException
  * @throws AccessControlException
  */
 public static boolean isShowDelete(Node content)
     throws AccessControlException, RepositoryException {
   boolean isEditMode = false;
   if (WCMComposer.MODE_EDIT.equals(getCurrentMode())) isEditMode = true;
   ((ExtendedNode) content).checkPermission(PermissionType.SET_PROPERTY);
   ((ExtendedNode) content).checkPermission(PermissionType.ADD_NODE);
   ((ExtendedNode) content).checkPermission(PermissionType.REMOVE);
   return isEditMode;
 }
コード例 #2
0
ファイル: Utils.java プロジェクト: canhpv/ecms
 /**
  * Check if the content is editable and current mode of the site is edit mode
  *
  * @param content the content node
  * @return true if there is no content if the content is editable and current mode is edit mode
  */
 public static boolean isShowQuickEdit(Node content) {
   if (content == null) return true;
   try {
     boolean isEditMode = false;
     if (WCMComposer.MODE_EDIT.equals(getCurrentMode())
         || Util.getUIPortalApplication().getModeState() != UIPortalApplication.NORMAL_MODE)
       isEditMode = true;
     ((ExtendedNode) content).checkPermission(PermissionType.SET_PROPERTY);
     ((ExtendedNode) content).checkPermission(PermissionType.ADD_NODE);
     ((ExtendedNode) content).checkPermission(PermissionType.REMOVE);
     return isEditMode;
   } catch (Exception e) {
     return false;
   }
 }
コード例 #3
0
ファイル: Utils.java プロジェクト: canhpv/ecms
 /**
  * Check if the node is viewable for the current user or not viewable. <br>
  * return True if the node is viewable, otherwise will return False
  *
  * @param node: The node to check
  */
 public static boolean isViewable(Node node) {
   try {
     node.refresh(true);
     ((ExtendedNode) node).checkPermission(PermissionType.READ);
   } catch (Exception e) {
     return false;
   }
   return true;
 }