mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
Created base for API endpoint and feature keys
This commit is contained in:
parent
2e3f52335a
commit
3a7f4be4bb
6 changed files with 87 additions and 0 deletions
|
|
@ -42,6 +42,10 @@ export class FeatureAbilityFactory extends AbilityFactory<FEATURE_KEY, Subjects>
|
|||
FEATURE_KEY.CREATE_QUERY_PERMISSIONS,
|
||||
FEATURE_KEY.UPDATE_QUERY_PERMISSIONS,
|
||||
FEATURE_KEY.DELETE_QUERY_PERMISSIONS,
|
||||
FEATURE_KEY.FETCH_COMPONENT_PERMISSIONS,
|
||||
FEATURE_KEY.CREATE_COMPONENT_PERMISSIONS,
|
||||
FEATURE_KEY.UPDATE_COMPONENT_PERMISSIONS,
|
||||
FEATURE_KEY.DELETE_COMPONENT_PERMISSIONS,
|
||||
],
|
||||
App
|
||||
);
|
||||
|
|
@ -64,6 +68,10 @@ export class FeatureAbilityFactory extends AbilityFactory<FEATURE_KEY, Subjects>
|
|||
FEATURE_KEY.CREATE_QUERY_PERMISSIONS,
|
||||
FEATURE_KEY.UPDATE_QUERY_PERMISSIONS,
|
||||
FEATURE_KEY.DELETE_QUERY_PERMISSIONS,
|
||||
FEATURE_KEY.FETCH_COMPONENT_PERMISSIONS,
|
||||
FEATURE_KEY.CREATE_COMPONENT_PERMISSIONS,
|
||||
FEATURE_KEY.UPDATE_COMPONENT_PERMISSIONS,
|
||||
FEATURE_KEY.DELETE_COMPONENT_PERMISSIONS,
|
||||
],
|
||||
App
|
||||
);
|
||||
|
|
@ -80,6 +88,7 @@ export class FeatureAbilityFactory extends AbilityFactory<FEATURE_KEY, Subjects>
|
|||
FEATURE_KEY.FETCH_USER_GROUPS,
|
||||
FEATURE_KEY.FETCH_PAGE_PERMISSIONS,
|
||||
FEATURE_KEY.FETCH_QUERY_PERMISSIONS,
|
||||
FEATURE_KEY.FETCH_COMPONENT_PERMISSIONS,
|
||||
],
|
||||
App
|
||||
);
|
||||
|
|
|
|||
|
|
@ -14,5 +14,9 @@ export const FEATURES: FeaturesConfig = {
|
|||
[FEATURE_KEY.CREATE_QUERY_PERMISSIONS]: {},
|
||||
[FEATURE_KEY.UPDATE_QUERY_PERMISSIONS]: {},
|
||||
[FEATURE_KEY.DELETE_QUERY_PERMISSIONS]: {},
|
||||
[FEATURE_KEY.FETCH_COMPONENT_PERMISSIONS]: {},
|
||||
[FEATURE_KEY.CREATE_COMPONENT_PERMISSIONS]: {},
|
||||
[FEATURE_KEY.UPDATE_COMPONENT_PERMISSIONS]: {},
|
||||
[FEATURE_KEY.DELETE_COMPONENT_PERMISSIONS]: {},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,4 +21,8 @@ export enum FEATURE_KEY {
|
|||
CREATE_QUERY_PERMISSIONS = 'create_query_permissions',
|
||||
UPDATE_QUERY_PERMISSIONS = 'update_query_permissions',
|
||||
DELETE_QUERY_PERMISSIONS = 'delete_query_permissions',
|
||||
FETCH_COMPONENT_PERMISSIONS = 'fetch_component_permissions',
|
||||
CREATE_COMPONENT_PERMISSIONS = 'create_component_permissions',
|
||||
UPDATE_COMPONENT_PERMISSIONS = 'update_component_permissions',
|
||||
DELETE_COMPONENT_PERMISSIONS = 'delete_component_permissions',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,4 +127,50 @@ export class AppPermissionsController implements IAppPermissionsController {
|
|||
): Promise<any> {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
@InitFeature(FEATURE_KEY.FETCH_COMPONENT_PERMISSIONS)
|
||||
@Get(':appId/components/:componentId')
|
||||
async fetchComponentPermissions(
|
||||
@User() user,
|
||||
@Param('appId') appId: string,
|
||||
@Param('componentId') componentId: string,
|
||||
@Res({ passthrough: true }) response: Response
|
||||
): Promise<any> {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
@InitFeature(FEATURE_KEY.CREATE_COMPONENT_PERMISSIONS)
|
||||
@Post(':appId/components/:componentId')
|
||||
async createComponentPermissions(
|
||||
@User() user,
|
||||
@Param('appId') appId: string,
|
||||
@Param('componentId') componentId: string,
|
||||
@Body() body: CreatePermissionDto,
|
||||
@Res({ passthrough: true }) response: Response
|
||||
): Promise<any> {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
@InitFeature(FEATURE_KEY.UPDATE_COMPONENT_PERMISSIONS)
|
||||
@Put(':appId/components/:componentId')
|
||||
async updateComponentPermissions(
|
||||
@User() user,
|
||||
@Param('appId') appId: string,
|
||||
@Param('componentId') componentId: string,
|
||||
@Body() body: CreatePermissionDto,
|
||||
@Res({ passthrough: true }) response: Response
|
||||
): Promise<any> {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
@InitFeature(FEATURE_KEY.DELETE_COMPONENT_PERMISSIONS)
|
||||
@Delete(':appId/components/:componentId')
|
||||
async deleteComponentPermissions(
|
||||
@User() user,
|
||||
@Param('appId') appId: string,
|
||||
@Param('componentId') componentId: string,
|
||||
@Res({ passthrough: true }) response: Response
|
||||
): Promise<any> {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,4 +46,24 @@ export interface IAppPermissionsController {
|
|||
): Promise<any>;
|
||||
|
||||
deleteQueryPermissions(user: User, appId: string, queryId: string, response: Response): Promise<any>;
|
||||
|
||||
fetchComponentPermissions(user: User, appId: string, componentId: string, response: Response): Promise<any>;
|
||||
|
||||
createComponentPermissions(
|
||||
user: User,
|
||||
appId: string,
|
||||
componentId: string,
|
||||
body: CreatePermissionDto,
|
||||
response: Response
|
||||
): Promise<any>;
|
||||
|
||||
updateComponentPermissions(
|
||||
user: User,
|
||||
appId: string,
|
||||
componentId: string,
|
||||
body: CreatePermissionDto,
|
||||
response: Response
|
||||
): Promise<any>;
|
||||
|
||||
deleteComponentPermissions(user: User, appId: string, componentId: string, response: Response): Promise<any>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ interface Features {
|
|||
[FEATURE_KEY.CREATE_QUERY_PERMISSIONS]: FeatureConfig;
|
||||
[FEATURE_KEY.UPDATE_QUERY_PERMISSIONS]: FeatureConfig;
|
||||
[FEATURE_KEY.DELETE_QUERY_PERMISSIONS]: FeatureConfig;
|
||||
[FEATURE_KEY.FETCH_COMPONENT_PERMISSIONS]: FeatureConfig;
|
||||
[FEATURE_KEY.CREATE_COMPONENT_PERMISSIONS]: FeatureConfig;
|
||||
[FEATURE_KEY.UPDATE_COMPONENT_PERMISSIONS]: FeatureConfig;
|
||||
[FEATURE_KEY.DELETE_COMPONENT_PERMISSIONS]: FeatureConfig;
|
||||
}
|
||||
|
||||
export interface FeaturesConfig {
|
||||
|
|
|
|||
Loading…
Reference in a new issue