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:
parent
42a8c30a40
commit
f897ebd134
1 changed files with 53 additions and 0 deletions
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue