@Override
 public boolean isUserAllowed(Content content, UserDetails currentUser) {
   try {
     if (!super.isUserAllowed(content, currentUser)) {
       return false;
     }
     boolean allowedType = false;
     List<SmallContentType> allowedContentTypes = this.getAllowedContentTypes(currentUser);
     for (int i = 0; i < allowedContentTypes.size(); i++) {
       SmallContentType smallContentType = allowedContentTypes.get(i);
       if (smallContentType.getCode().equals(content.getTypeCode())) {
         allowedType = true;
         break;
       }
     }
     if (!allowedType) {
       return false;
     }
     String status = content.getStatus();
     if (status != null
         && !status.equals(Content.STATUS_NEW)
         && !status.equals(Content.STATUS_DRAFT)) {
       if (status.equals(Content.STATUS_READY) || status.equals(Content.STATUS_PUBLIC)) {
         boolean isSupervisor =
             this.getAuthorizationManager().isAuthOnPermission(currentUser, Permission.SUPERVISOR);
         if (!isSupervisor) {
           return false;
         }
       } else {
         List<Step> steps = this.getWorkflowManager().getSteps(content.getTypeCode());
         boolean auth = false;
         for (int i = 0; i < steps.size(); i++) {
           Step step = steps.get(i);
           if (step.getCode().equals(status)) {
             if (step.getRole() != null || this.checkRole(step.getRole(), currentUser)) {
               auth = true;
               break;
             }
           }
         }
         if (!auth) {
           return false;
         }
       }
     }
   } catch (Throwable t) {
     ApsSystemUtils.logThrowable(t, this, "isUserAllowed");
     throw new RuntimeException("Error checking user authority", t);
   }
   return true;
 }
 @Override
 public String getPreviousStep(String currentStep, String typeCode) {
   String previousStep = null;
   if (!currentStep.equals(Content.STATUS_NEW) && !currentStep.equals(Content.STATUS_DRAFT)) {
     List<Step> steps = this.getWorkflowManager().getSteps(typeCode);
     previousStep = Content.STATUS_DRAFT;
     if (Content.STATUS_READY.equals(currentStep)) {
       if (steps.size() > 0) {
         previousStep = steps.get(steps.size() - 1).getCode();
       }
     } else {
       for (int i = 0; i < steps.size(); i++) {
         Step step = steps.get(i);
         if (step.getCode().equals(currentStep)) {
           break;
         }
         previousStep = step.getCode();
       }
     }
   }
   return previousStep;
 }
 @Override
 public List<SelectItem> getAvalaibleStatus(UserDetails user, String contentTypeCode) {
   List<SelectItem> items = new ArrayList<SelectItem>();
   String roleName = this.getWorkflowManager().getRole(contentTypeCode);
   if (!this.checkRole(roleName, user)) {
     return items;
   }
   Workflow workflow = this.getWorkflowManager().getWorkflow(contentTypeCode);
   items.add(new SelectItem(Content.STATUS_DRAFT, "name.contentStatus." + Content.STATUS_DRAFT));
   if (null != workflow) {
     Iterator<Step> stepsIter = workflow.getSteps().iterator();
     while (stepsIter.hasNext()) {
       Step step = stepsIter.next();
       if (this.checkRole(step.getRole(), user)) {
         items.add(new SelectItem(step.getCode(), step.getDescr()));
       }
     }
   }
   if (this.getAuthorizationManager().isAuthOnPermission(user, Permission.SUPERVISOR)) {
     items.add(new SelectItem(Content.STATUS_READY, "name.contentStatus." + Content.STATUS_READY));
   }
   return items;
 }