Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add importer role #410

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/cgimap/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ using osm_edition_t = std::pair<osm_nwr_id_t, osm_version_t>;
// user roles, used in the OSM permissions system.
enum class osm_user_role_t {
administrator,
moderator
moderator,
importer
};

// OSMChange message operations
Expand Down
2 changes: 2 additions & 0 deletions src/backend/apidb/readonly_pgsql_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,8 @@ std::set< osm_user_role_t > readonly_pgsql_selection::get_roles_for_user(osm_use
roles.insert(osm_user_role_t::moderator);
} else if (role == "administrator") {
roles.insert(osm_user_role_t::administrator);
} else if (role == "importer") {
roles.insert(osm_user_role_t::importer);
}
}

Expand Down
2 changes: 2 additions & 0 deletions test/test_apidb_backend_roles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ std::ostream &operator<<(
out << "moderator";
} else if (r == osm_user_role_t::administrator) {
out << "administrator";
} else if (r == osm_user_role_t::importer) {
out << "importer";
}
}
out << "}";
Expand Down
3 changes: 3 additions & 0 deletions test/test_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ osm_user_role_t parse_role(const std::string &str) {
} else if (str == "moderator") {
return osm_user_role_t::moderator;

} else if (str == "importer") {
return osm_user_role_t::importer;

} else {
throw std::runtime_error("Unable to parse role in config file.");
}
Expand Down