Skip to content

Commit

Permalink
feat(plugins/templates): add policies for templates
Browse files Browse the repository at this point in the history
  • Loading branch information
tks18 committed Jan 4, 2022
1 parent 7faf8b4 commit a147255
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/templates/policies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { map as scopeMap } from './scopes';
import { map as sacMap } from './service-accounts';
import { map as smtpMailerMap } from './smtp-mailer';
import { map as smtpProviderMap } from './smtp-providers';
import { map as templatesMap } from './templates';

export { default as users } from './user';
export { default as credentials } from './credentials';
Expand All @@ -23,6 +24,7 @@ export { default as scopes } from './scopes';
export { default as serviceAccounts } from './service-accounts';
export { default as smtpMailers } from './smtp-mailer';
export { default as smtpProviders } from './smtp-providers';
export { default as templates } from './templates';

export const map = [
...userMap,
Expand All @@ -35,4 +37,5 @@ export const map = [
...sacMap,
...smtpMailerMap,
...smtpProviderMap,
...templatesMap,
];
9 changes: 9 additions & 0 deletions plugins/templates/policies/templates/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { templates_add, templates_edit, templates_rm } from './policies';

export default {
add: templates_add,
edit: templates_edit,
remove: templates_rm,
};

export const map = [templates_add, templates_edit, templates_rm];
35 changes: 35 additions & 0 deletions plugins/templates/policies/templates/policies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @file Policy Definition File
* @description Policies Related to Adding and Modifying Templates
* @module - Templates
* @author Sudharshan TK
*/

import { IPolicy } from '@models/policy/types';
import { objectID } from '@plugins/misc/uid';

const CODE = 'template';

export const templates_add: Readonly<IPolicy> = {
_id: objectID('p'),
code: `${CODE}add`,
name: 'Add Templates to Database',
message: 'Enable Adding of Templates to Database',
global_flag: true,
};

export const templates_edit: Readonly<IPolicy> = {
_id: objectID('p'),
code: `${CODE}edit`,
name: 'Edit Templates',
message: 'Enable Editing of Templates in Database',
global_flag: true,
};

export const templates_rm: Readonly<IPolicy> = {
_id: objectID('p'),
code: `${CODE}rm`,
name: 'Remove Templates',
message: 'Enable Removal of Templates from Database',
global_flag: true,
};

0 comments on commit a147255

Please sign in to comment.