Package com.dotmarketing.business

Examples of com.dotmarketing.business.Role


      throw new SystemException(e);
    }
    Iterator<Role> rolesIt = roles.iterator();
    boolean isMailingListEditor = false;
    while (rolesIt.hasNext()) {
      Role role = (Role) rolesIt.next();
      if (role.getName().equals(Config.getStringProperty("MAILINGLISTS_EDITOR_ROLE"))) {
        isMailingListEditor = true;
        break;
      }
    }
    return isMailingListEditor;
View Full Code Here


      throw new SystemException(e);
    }
    Iterator<Role> rolesIt = roles.iterator();
    boolean isMailingListAdmin = false;
    while (rolesIt.hasNext()) {
      Role role = (Role) rolesIt.next();
      if (role.getName().equals(Config.getStringProperty("MAILINGLISTS_ADMIN_ROLE")) ||
          role.getName().equals(Config.getStringProperty("USER_MANAGER_ADMIN_ROLE"))) {
        isMailingListAdmin = true;
        break;
      }
    }
    return isMailingListAdmin;
View Full Code Here

      List roles = com.dotmarketing.business.APILocator.getRoleAPI().loadRolesForUser(user.getUserId());
      boolean isMarketingAdmin = false;
     
      Iterator rolesIt = roles.iterator();
      while (rolesIt.hasNext()) {
          Role role = (Role) rolesIt.next();
          if (UtilMethods.isSet(role.getRoleKey()) && role.getRoleKey().equals(Config.getStringProperty("MAILINGLISTS_ADMIN_ROLE"))) {
              isMarketingAdmin = true;
              break;
          }
      }
     
View Full Code Here

    //getting the user roles
    boolean isCampaignManagerAdmin = false;
    String campaignManagerAdminRoleKey = "";
    try {
      Role campaignManagerAdminRole = APILocator.getRoleAPI().loadRoleByKey(Config.getStringProperty("CAMPAIGN_MANAGER_ADMIN"));
      campaignManagerAdminRoleKey = campaignManagerAdminRole.getRoleKey();
    }
    catch (Exception e) {}

    boolean isCampaignManagerEditor = false;
    String campaignManagerEditorRoleKey = "";
    try {
      Role campaignManagerEditorRole = APILocator.getRoleAPI().loadRoleByKey(Config.getStringProperty("CAMPAIGN_MANAGER_EDITOR"));
      campaignManagerEditorRoleKey = campaignManagerEditorRole.getRoleKey();
    }
    catch (Exception e) {}

    Role[] userRoles = (Role[])APILocator.getRoleAPI().loadRolesForUser(user.getUserId()).toArray(new Role[0]);
    for (int i = 0; i < userRoles.length; i++) {
      Role userrole = (Role) userRoles[i];
      if ((userrole.getRoleKey() != null) && userrole.getRoleKey().equals(campaignManagerAdminRoleKey)) {
        isCampaignManagerAdmin = true;
        if (isCampaignManagerEditor)
          break;
      }
      if ((userrole.getRoleKey() != null) && userrole.getRoleKey().equals(campaignManagerEditorRoleKey)) {
        isCampaignManagerEditor = true;
        if (isCampaignManagerAdmin)
          break;
      }
    }
View Full Code Here

            for ( String perm : whoCanUse ) {
                if ( !UtilMethods.isSet( perm ) ) {
                    continue;
                }

                Role role = resolveRole( perm );
                Permission p = new Permission( newAction.getId(), role.getId(), PermissionAPI.PERMISSION_USE );

                boolean exists = false;
                for ( Permission curr : permissions ) {
                    exists = exists || curr.getRoleId().equals( p.getRoleId() );
                }
View Full Code Here

 
 
 
 
  private Role resolveRole(String id) throws DotDataException{
    Role test = null;
   
    String newid = id.substring(id.indexOf("-") + 1, id.length());
   
    if(id.startsWith("user-")){
      test = APILocator.getRoleAPI().loadRoleByKey(newid);
View Full Code Here

    ServletOutputStream out = httpRes.getOutputStream();
 
    boolean isCampaignManagerViewer = false;
    String campaignManagerViewerRoleKey = "";
    try {
      Role campaignManagerViewerRole = APILocator.getRoleAPI().loadRoleByKey(Config.getStringProperty("CAMPAIGN_MANAGER_VIEWER"));
      campaignManagerViewerRoleKey = campaignManagerViewerRole.getRoleKey();
    }
    catch (Exception e) {}

    try {
      Role[] userRoles = (Role[])APILocator.getRoleAPI().loadRolesForUser(user.getUserId()).toArray(new Role[0]);
      for (int i = 0; i < userRoles.length; i++) {
        Role userRole = (Role) userRoles[i];
        if (userRole.getRoleKey().equals(campaignManagerViewerRoleKey)) {
          isCampaignManagerViewer = true;
        }
      }
    }
    catch (Exception e) {
View Full Code Here

    return true;
  }

  public List<Map<String, Object>> getUserRoles (String userId) throws Exception {
    List<Map<String, Object>> roleMaps = new ArrayList<Map<String,Object>>();
    Role userRole = APILocator.getRoleAPI().loadRoleByKey(RoleAPI.USERS_ROOT_ROLE_KEY);
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
        HttpServletRequest request = ctx.getHttpServletRequest();

    // lock down to users with access to Users portlet
        User loggedInUser=uWebAPI.getLoggedInUser(request);
        if(loggedInUser==null || !APILocator.getPortletAPI().hasUserAdminRights(loggedInUser)) {
            SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call getUserRoles by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
            throw new DotSecurityException("not authorized");
        }

    if(UtilMethods.isSet(userId)){
      RoleAPI roleAPI = APILocator.getRoleAPI();
      List<com.dotmarketing.business.Role> roles = roleAPI.loadRolesForUser(userId, false);
      for(com.dotmarketing.business.Role r : roles) {

        String DBFQN =  r.getDBFQN();

        if(DBFQN.contains(userRole.getId())) {
          continue;
        }
        roleMaps.add(r.toMap());
      }
    }
View Full Code Here

            SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call getRoleById by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
            throw new DotSecurityException("not authorized");
        }

    RoleAPI api = APILocator.getRoleAPI();
    Role role;
    try {
      role = com.dotmarketing.business.APILocator.getRoleAPI().loadRoleById(roleId);
    } catch (DotDataException e) {
      Logger.error(this, e.getMessage(), e);
      return null;
    }
    if(role == null){
      return null;
    }
    HashMap<String, Object> aRecord = new HashMap<String, Object>();
    aRecord.put("id", role.getId());
    aRecord.put("type", ROLE_TYPE_VALUE);
    aRecord.put("name", role.getName());
    aRecord.put("emailaddress", "");
    return aRecord;
  }
View Full Code Here



      WorkflowTask task = processor.getTask();
      if(task != null){
        Role r = APILocator.getRoleAPI().getUserRole(processor.getUser());
        if(task.isNew()){

          task.setCreatedBy(r.getId());
          task.setWebasset(processor.getContentlet().getIdentifier());
          if(processor.getWorkflowMessage() != null){
            task.setDescription(processor.getWorkflowMessage());
          }
        }
        task.setTitle(processor.getContentlet().getTitle());
        task.setModDate(new java.util.Date());
        if(processor.getNextAssign() != null)
          task.setAssignedTo(processor.getNextAssign().getId());
        task.setStatus(processor.getNextStep().getId());

        saveWorkflowTask(task,processor);
        if(processor.getWorkflowMessage() != null){
          WorkflowComment comment = new WorkflowComment();
          comment.setComment(processor.getWorkflowMessage());

          comment.setWorkflowtaskId(task.getId());
          comment.setCreationDate(new Date());
          comment.setPostedBy(r.getId());
          saveComment(comment);
        }
      }

      List<WorkflowActionClass> actionClasses = processor.getActionClasses();
View Full Code Here

TOP

Related Classes of com.dotmarketing.business.Role

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.