feat(authorization): add read connection checks

This commit is contained in:
Ali BARIN
2023-06-23 20:20:42 +00:00
parent 75b3730a70
commit e8f2802ee0
3 changed files with 6 additions and 2 deletions

View File

@@ -6,6 +6,8 @@ type Params = {
};
const getApp = async (_parent: unknown, params: Params, context: Context) => {
context.currentUser.can('read', 'Connection');
const app = await App.findOneByKey(params.key);
if (context.currentUser) {

View File

@@ -1,5 +1,5 @@
import App from '../../models/app';
import { IApp } from '@automatisch/types';
import App from '../../models/app';
type Params = {
name: string;

View File

@@ -1,6 +1,6 @@
import { IConnection } from '@automatisch/types';
import App from '../../models/app';
import Context from '../../types/express/context';
import { IApp, IConnection } from '@automatisch/types';
type Params = {
name: string;
@@ -11,6 +11,8 @@ const getConnectedApps = async (
params: Params,
context: Context
) => {
context.currentUser.can('read', 'Connection');
let apps = await App.findAll(params.name);
const connections = await context.currentUser