oneuptime/ApiReference/Service/Permissions.ts

35 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-03-19 14:11:55 +00:00
import { PermissionHelper, PermissionProps } from 'Common/Types/Permission';
2023-03-18 21:48:21 +00:00
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
2023-03-18 21:37:34 +00:00
2023-03-18 21:48:21 +00:00
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
2023-03-18 21:37:34 +00:00
2023-03-18 21:48:21 +00:00
export default class ServiceHandler {
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
let pageTitle: string = '';
let pageDescription: string = '';
const page: string | undefined = req.params['page'];
const pageData: any = {};
2023-03-18 21:37:34 +00:00
2023-03-18 21:48:21 +00:00
pageTitle = 'Permissions';
pageDescription = 'Learn how permisisons work with OneUptime';
2023-03-18 21:37:34 +00:00
2023-03-20 18:06:50 +00:00
pageData.permissions = PermissionHelper.getAllPermissionProps().filter(
(i: PermissionProps) => {
return i.isAssignableToTenant;
}
);
2023-03-19 14:11:55 +00:00
2023-03-18 21:37:34 +00:00
return res.render('pages/index', {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
2023-03-18 21:48:21 +00:00
pageData: pageData,
2023-03-18 21:37:34 +00:00
});
}
2023-03-18 21:48:21 +00:00
}