rewrote getchildusers

This commit is contained in:
Kim 2023-03-23 15:45:40 +01:00
parent 55628e2186
commit c2d10b63d2
2 changed files with 12 additions and 2 deletions

View File

@ -171,8 +171,8 @@ public class Controller : ControllerBase
return folder; return folder;
} }
[HttpGet(nameof(GetAllChildUsers))] [HttpGet(nameof(GetAllDirectChildUsers))]
public ActionResult<IEnumerable<User>> GetAllChildUsers(Token authToken) public ActionResult<IEnumerable<User>> GetAllDirectChildUsers(Token authToken)
{ {
var user = Db.GetSession(authToken)?.User; var user = Db.GetSession(authToken)?.User;
if (user == null) if (user == null)
@ -181,6 +181,16 @@ public class Controller : ControllerBase
return user.ChildUsers().ToList(); return user.ChildUsers().ToList();
} }
[HttpGet(nameof(GetAllChildUsers))]
public ActionResult<IEnumerable<User>> GetAllChildUsers(Token authToken)
{
var user = Db.GetSession(authToken)?.User;
if (user == null)
return Unauthorized();
return user.DescendantUsers().ToList();
[HttpGet(nameof(GetAllInstallations))] [HttpGet(nameof(GetAllInstallations))]
public ActionResult<IEnumerable<Installation>> GetAllInstallations(Token authToken) public ActionResult<IEnumerable<Installation>> GetAllInstallations(Token authToken)
{ {