Added a command line tool for user management (#420)

The CLI tool can be started from the root of the /App directory in the
container with the command:
`./gaseous-cli`

Running without arguments presents the following help screen:
```
Gaseous CLI - A tool for managing the Gaseous Server
Usage: gaseous-cli [command] [options]
Commands:
  user [command] [options] - Manage users
  role [command] [options] - Manage roles
  help - Display this help message
```
This commit is contained in:
Michael Green
2024-09-09 15:11:36 +10:00
committed by GitHub
parent 7dfb0b54eb
commit bb86cb52f6
8 changed files with 436 additions and 91 deletions

View File

@@ -14,33 +14,40 @@ namespace Authentication
get
{
string _highestRole = "";
foreach (string role in Roles)
if (Roles != null)
{
switch (role)
foreach (string role in Roles)
{
case "Admin":
// there is no higher
_highestRole = role;
break;
case "Gamer":
// only one high is Admin, so check for that
if (_highestRole != "Admin")
{
switch (role)
{
case "Admin":
// there is no higher
_highestRole = role;
}
break;
case "Player":
// make sure _highestRole isn't already set to Gamer or Admin
if (_highestRole != "Admin" && _highestRole != "Gamer")
{
_highestRole = role;
}
break;
default:
_highestRole = "Player";
break;
break;
case "Gamer":
// only one high is Admin, so check for that
if (_highestRole != "Admin")
{
_highestRole = role;
}
break;
case "Player":
// make sure _highestRole isn't already set to Gamer or Admin
if (_highestRole != "Admin" && _highestRole != "Gamer")
{
_highestRole = role;
}
break;
default:
_highestRole = "Player";
break;
}
}
}
else
{
_highestRole = "Player";
}
return _highestRole;
}