1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 13:29:22 +00:00

Can find a user by its sub folder

This commit is contained in:
Pierre HUBERT 2019-12-28 14:34:42 +01:00
parent 92723b487a
commit 8eb69469a7
2 changed files with 20 additions and 0 deletions

View File

@ -148,6 +148,8 @@ export const Routes : Route[] = [
// Virtual directory controller
{path: "/user/findbyfolder", cb: (h) => VirtualDirectoryController.FindUser(h)},
{path: "/virtualDirectory/find", cb: (h) => VirtualDirectoryController.Find(h)},
]

View File

@ -10,6 +10,24 @@ import { GroupsHelper } from "../helpers/GroupsHelper";
export class VirtualDirectoryController {
/**
* Find a user by its virtual directory
*
* @param h Request handler
*/
public static async FindUser(h: RequestHandler) {
const virtualDirectory = h.postVirtualDirectory("subfolder");
const userID = await UserHelper.FindByFolder(virtualDirectory);
if(userID < 1)
h.error(404, "No user was found with this subfolder!");
h.send({
userID: userID
});
}
/**
* Find a group / user using a given virtual directory
*