feat(authorization): add read connection checks
This commit is contained in:
@@ -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) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import App from '../../models/app';
|
||||
import { IApp } from '@automatisch/types';
|
||||
import App from '../../models/app';
|
||||
|
||||
type Params = {
|
||||
name: string;
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user