Package com.taskadapter.redmineapi.bean

Examples of com.taskadapter.redmineapi.bean.Role


    result.setName(JsonInput.getStringOrNull(content, "name"));
    return result;
  }

  public static Role parseRole(JSONObject content) throws JSONException {
    final Role role = RoleFactory.create(JsonInput.getIntOrNull(content, "id"));
    role.setName(JsonInput.getStringOrNull(content, "name"));
    role.setInherited(content.has("inherited")
        && content.getBoolean("inherited"));
    if (content.has("permissions")) {
        final JSONArray perms = content.getJSONArray("permissions");
        final Set<String> permSet = new HashSet<String>();
        for (int i = 0; i < perms.length(); i++)
            permSet.add(perms.getString(i));
        role.addPermissions(permSet);
    }
    return role;
  }
View Full Code Here


    @Test
    public void testGetRoleById() throws RedmineException {
        final Collection<Role> roles = userManager.getRoles();
        for (Role r : roles) {
            final Role loaded = userManager.getRoleById(r.getId());
            assertEquals(r.getName(), loaded.getName());
            assertEquals(r.getInherited(), loaded.getInherited());
        }
    }
View Full Code Here

    @Test
    public void testRolesHasPermissions() throws RedmineException {
        final Collection<Role> roles = userManager.getRoles();
        for (Role r : roles) {
            final Role loaded = userManager.getRoleById(r.getId());
            if (loaded.getPermissions() != null && !loaded.getPermissions().isEmpty())
                return;

        }
        fail("Failed to find a role with a permissions");
    }
View Full Code Here

TOP

Related Classes of com.taskadapter.redmineapi.bean.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.