mirror of
https://github.com/matrix-construct/construct
synced 2025-02-18 17:50:16 +01:00
modules/console: Add user activation command suite.
This commit is contained in:
parent
3d056c66d6
commit
aaf4c1f76b
1 changed files with 85 additions and 0 deletions
|
@ -1901,6 +1901,91 @@ console_cmd__user__password(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__user__active(opt &out, const string_view &line)
|
||||
{
|
||||
const params param
|
||||
{
|
||||
line, " ",
|
||||
{
|
||||
"user_id"
|
||||
}
|
||||
};
|
||||
|
||||
const m::user user
|
||||
{
|
||||
param.at(0)
|
||||
};
|
||||
|
||||
out << user.user_id << " is "
|
||||
<< (user.is_active()? "active" : "inactive")
|
||||
<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__user__activate(opt &out, const string_view &line)
|
||||
{
|
||||
const params param
|
||||
{
|
||||
line, " ",
|
||||
{
|
||||
"user_id"
|
||||
}
|
||||
};
|
||||
|
||||
m::user user
|
||||
{
|
||||
param.at(0)
|
||||
};
|
||||
|
||||
if(user.is_active())
|
||||
{
|
||||
out << user.user_id << " is already active" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto eid
|
||||
{
|
||||
user.activate()
|
||||
};
|
||||
|
||||
out << eid << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__user__deactivate(opt &out, const string_view &line)
|
||||
{
|
||||
const params param
|
||||
{
|
||||
line, " ",
|
||||
{
|
||||
"user_id"
|
||||
}
|
||||
};
|
||||
|
||||
m::user user
|
||||
{
|
||||
param.at(0)
|
||||
};
|
||||
|
||||
if(!user.is_active())
|
||||
{
|
||||
out << user.user_id << " is already inactive" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto eid
|
||||
{
|
||||
user.deactivate()
|
||||
};
|
||||
|
||||
out << eid << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// fed
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue