summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-06-14 11:48:12 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-06-14 11:48:12 +0200
commitf34668f94b6a69fa777c6025ccc798b5e3c1110f (patch)
tree9797b1ebb1bf845481cd3d50df369fb558bb860e /application
parent9fc9f2005e750aeb433609a583c8b1c460c4b78b (diff)
Add cli user deletion
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/controllers/User.php18
-rw-r--r--application/helpers/filebin_helper.php1
2 files changed, 19 insertions, 0 deletions
diff --git a/application/controllers/User.php b/application/controllers/User.php
index 26704f3e5..c98784d50 100644
--- a/application/controllers/User.php
+++ b/application/controllers/User.php
@@ -696,4 +696,22 @@ class User extends MY_Controller {
echo "User added\n";
}
+
+ function delete_user()
+ {
+ $this->_require_cli_request();
+ $this->duser->require_implemented("can_delete_account");
+
+ echo "\nWARNING: Deleting a user will delete ALL their data permanently.\n\n";
+
+ $username = $this->_get_line_cli("Username", function($username) {
+ if (get_instance()->muser->username_exists($username)) {
+ return true;
+ }
+ return false;
+ });
+ $this->muser->delete_user_real($username);
+ echo "User removed\n";
+ }
+
}
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php
index 189b35db1..d42b2ad87 100644
--- a/application/helpers/filebin_helper.php
+++ b/application/helpers/filebin_helper.php
@@ -426,6 +426,7 @@ function output_cli_usage() {
echo " file nuke_id <ID> Nukes all IDs sharing the same hash\n";
echo " user cron Cronjob\n";
echo " user add_user Add a user\n";
+ echo " user delete_user Delete a user including all their data\n";
echo " tools update_database Update/Initialise the database\n";
echo "\n";
echo "Functions that shouldn't have to be run:\n";