Package com.dotmarketing.business

Examples of com.dotmarketing.business.Role


    environment.setPushToAll( false );

    /*
     * Find the roles of the admin user
     */
    Role role = APILocator.getRoleAPI().loadRoleByKey( adminUser.getUserId() );

    //Create the permissions for the environment
    List<Permission> permissions = new ArrayList<Permission>();
    Permission p = new Permission( environment.getId(), role.getId(), PermissionAPI.PERMISSION_USE );
    permissions.add( p );

    /*
     * Create a environment
     */
 
View Full Code Here


    environment.setPushToAll( false );

    /*
     * Find the roles of the admin user
     */
    Role role = APILocator.getRoleAPI().loadRoleByKey( adminUser.getUserId() );

    //Create the permissions for the environment
    List<Permission> permissions = new ArrayList<Permission>();
    Permission p = new Permission( environment.getId(), role.getId(), PermissionAPI.PERMISSION_USE );
    permissions.add( p );

    /*
     * Create a environment
     */
 
View Full Code Here

        APILocator.getWorkflowAPI().saveSchemeForStruct(st, scheme);
       
        // send the Rest api call
        User sysuser=APILocator.getUserAPI().getSystemUser();
        User bill=APILocator.getUserAPI().loadUserById("dotcms.org.2806");
        Role billrole=APILocator.getRoleAPI().getUserRole(bill);
        ClientResponse response=contRes.path("/Save%20and%20Assign/1/wfActionComments/please%20do%20this%20for%20me/wfActionAssign/"+billrole.getId())
            .type(MediaType.APPLICATION_JSON_TYPE)
            .header(authheader, authvalue).put(ClientResponse.class,
                new JSONObject()
                    .put("stInode", st.getInode())
                    .put("languageId", 1)
                    .put(field.getVelocityVarName(), "test title "+salt)
                    .toString());
        Assert.assertEquals(200, response.getStatus());
       
        Contentlet cont = APILocator.getContentletAPI().find(response.getHeaders().getFirst("inode"), sysuser, false);
        Assert.assertNotNull(cont);
        Assert.assertTrue(InodeUtils.isSet(cont.getIdentifier()));
       
        // must be in the first step
        Assert.assertEquals(step1.getId(), APILocator.getWorkflowAPI().findStepByContentlet(cont).getId());
       
        boolean assigned=false;
       
        HashMap<String, Object> map = new HashMap<String,Object>();
        map.put("assignedTo",billrole.getId());
        for(WorkflowTask task : APILocator.getWorkflowAPI().searchTasks(new WorkflowSearcher(map, sysuser))) {
            if(task.getWebasset().equals(cont.getIdentifier())) {
                assigned=true;
                Assert.assertEquals("please do this for me",task.getDescription());
                break;
View Full Code Here

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

  public Object authenticate(String username, String password) {
    try {
      User user =  dotDavHelper.authorizePrincipal(username, password);
       
      //Get the Administrator Role to validate if the user has permission
      Role cmsAdminRole = com.dotmarketing.business.APILocator.getRoleAPI().loadCMSAdminRole();
      if(com.dotmarketing.business.APILocator.getRoleAPI().doesUserHaveRole(user,cmsAdminRole.getId())){
        return user;
      }else{
        return null;
      }
    } catch (Exception e) {
View Full Code Here

    if(!perAPI.doesUserHavePermission(child, PermissionAPI.PERMISSION_WRITE, user, respectFrontendRoles)){
      List<Role> rolesPublish = perAPI.getRoles(child.getCategoryId(), PermissionAPI.PERMISSION_PUBLISH, "CMS Owner", 0, -1);
      List<Role> rolesWrite = perAPI.getRoles(child.getCategoryId(), PermissionAPI.PERMISSION_WRITE, "CMS Owner", 0, -1);

      Role cmsOwner = APILocator.getRoleAPI().loadCMSOwnerRole();
      boolean isCMSOwner = false;
      if(rolesPublish.size() > 0 || rolesWrite.size() > 0){
        for (Role role : rolesPublish) {
          if(role.getId().equals(cmsOwner.getId())){
            isCMSOwner = true;
            break;
          }
        }
        if(!isCMSOwner){
          for (Role role : rolesWrite) {
            if(role.getId().equals(cmsOwner.getId())){
              isCMSOwner = true;
              break;
            }
          }
        }
View Full Code Here

            List list = null;
            List roles = APILocator.getRoleAPI().loadRolesForUser(user.getUserId());
            Iterator rolesIt = roles.iterator();
            boolean isMarketingAdmin = false;
            while (rolesIt.hasNext()) {
                Role role = (Role) rolesIt.next();
                if (role.getName().equals(Config.getStringProperty("MAILINGLISTS_ADMIN_ROLE"))) {
                    isMarketingAdmin = true;
                    break;
                }
            }
            if (isMarketingAdmin) {
View Full Code Here

    HostAPI hostAPI = APILocator.getHostAPI();
    User systemUser = APILocator.getUserAPI().getSystemUser();
    String roleId = p.getRoleId();
    Map<String, Object> roleMap = roles.get(roleId);
    if(roleMap == null) {
      Role role = roleAPI.loadRoleById(roleId);
      if(role == null)
        return;
      roleMap = role.toMap();
      roles.put(role.getId(), roleMap);
      if(!inheritable) {
        if(p.getInode().equals(perm.getPermissionId())) {
          roleMap.put("inherited", false);
        } else {
          roleMap.put("inherited", true);
View Full Code Here

  {
    try
    {
      StringBuffer emailsSB = new StringBuffer();
      //Get the members in the group
      Role role = APILocator.getRoleAPI().loadRoleByKey(roleKey);
      List<User> users = new ArrayList<User>();
      List<String> uIDs = APILocator.getRoleAPI().findUserIdsForRole(role);
      for (String uid : uIDs) {
        users.add(APILocator.getUserAPI().loadUserById(uid, APILocator.getUserAPI().getSystemUser(), true));
      }
View Full Code Here

   */
  public static void sendWorkflowMessageToNextAssign(WorkflowProcessor processor, String subject, String emailText, Boolean isHTML) {

    try {

      Role assignedTo = null;

      assignedTo = processor.getNextAssign();
      if (assignedTo == null) {
        throw new WorkflowActionFailureException("Next assign does not exist");
      }

      // add the next assign if a user
      Set<String> recipients = new HashSet<String>();
      try {
        recipients.add(APILocator.getUserAPI()
            .loadUserById(assignedTo.getRoleKey(), APILocator.getUserAPI().getSystemUser(), false).getEmailAddress());
      } catch (Exception e) {

      }

      // add the user if next assign if a role
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.