@Override
 public Set<Role> listRoles(String sourceId) throws NoSuchAuthorizationManagerException {
   if (ALL_ROLES_KEY.equalsIgnoreCase(sourceId)) {
     return listRoles();
   } else {
     AuthorizationManager authzManager = getAuthorizationManager(sourceId);
     return authzManager.listRoles();
   }
 }
  @Override
  public Set<Privilege> listPrivileges() {
    Set<Privilege> result = new HashSet<>();
    for (AuthorizationManager authzManager : authorizationManagers.values()) {
      Set<Privilege> privileges = authzManager.listPrivileges();
      if (privileges != null) {
        result.addAll(privileges);
      }
    }

    return result;
  }