mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 21:39:22 +00:00
Can find a user by its sub folder
This commit is contained in:
parent
92723b487a
commit
8eb69469a7
@ -148,6 +148,8 @@ export const Routes : Route[] = [
|
|||||||
|
|
||||||
|
|
||||||
// Virtual directory controller
|
// Virtual directory controller
|
||||||
|
{path: "/user/findbyfolder", cb: (h) => VirtualDirectoryController.FindUser(h)},
|
||||||
|
|
||||||
{path: "/virtualDirectory/find", cb: (h) => VirtualDirectoryController.Find(h)},
|
{path: "/virtualDirectory/find", cb: (h) => VirtualDirectoryController.Find(h)},
|
||||||
|
|
||||||
]
|
]
|
@ -10,6 +10,24 @@ import { GroupsHelper } from "../helpers/GroupsHelper";
|
|||||||
|
|
||||||
export class VirtualDirectoryController {
|
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
|
* Find a group / user using a given virtual directory
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user