0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-03-24 02:10:28 +01:00

modules/console: Add preliminary user pushrules cmd.

This commit is contained in:
Jason Volk 2020-03-18 14:28:10 -07:00
parent 42a8c30a40
commit f897ebd134

View file

@ -11999,6 +11999,59 @@ console_cmd__user__breadcrumb_rooms(opt &out, const string_view &line)
return true;
}
bool
console_cmd__user__pushrules(opt &out, const string_view &line)
{
const params param{line, " ",
{
"user_id", "scope", "kind", "ruleid"
}};
const m::user::id &user_id
{
param.at("user_id")
};
const auto &scope
{
param["scope"]
};
const auto &kind
{
param["kind"]
};
const auto &ruleid
{
param["ruleid"]
};
const m::user::pushrules pushrules
{
user_id
};
pushrules.for_each({scope, kind, ruleid}, [&out]
(const auto &path, const json::object &rule)
{
const auto &[scope, kind, ruleid]
{
path
};
out
<< std::left << std::setw(10) << scope << " | "
<< std::left << std::setw(10) << kind << " | "
<< std::left << std::setw(32) << ruleid << " "
<< string_view{rule}
<< std::endl;
return true;
});
return true;
}
//
// users
//