mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-25 23:09:22 +00:00
Can check the availability of a virtual directory for a user
This commit is contained in:
parent
03100e0bd3
commit
b45e5c4d0a
@ -85,6 +85,8 @@ export const Routes : Route[] = [
|
||||
|
||||
{path: "/settings/set_general", cb: (h) => SettingsController.SetGeneral(h)},
|
||||
|
||||
{path: "/settings/check_user_directory_availability", cb: (h) => SettingsController.CheckDirectoryAvailability(h)},
|
||||
|
||||
|
||||
// Friends controller
|
||||
{path: "/friends/getList", cb: (h) => FriendsController.GetList(h)},
|
||||
|
@ -88,4 +88,19 @@ export class SettingsController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the availablity of a virtual directory for a user
|
||||
*
|
||||
* @param h Request handler
|
||||
*/
|
||||
public static async CheckDirectoryAvailability(h: RequestHandler) {
|
||||
const directory = h.postVirtualDirectory("directory");
|
||||
|
||||
if(!await checkVirtualDirectoryAvailability(directory, h.getUserId(), VirtualDirType.USER))
|
||||
h.error(401, "The specified directory is unavailable!");
|
||||
|
||||
h.success("The directory is available!");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user