Replaced LINK per CREATE
MODIFY
src/authorization/Authorizations.ts
src/authorization/Authorizations.ts
@@ -601,8 +601,8 @@ export default class Authorizations {
return Authorizations.canPerformAction(loggedUser, Entity.INVOICES, Action.SYNCHRONIZE);
}
- public static canLinkTransactionToInvoice(loggedUser: UserToken): boolean {
- return Authorizations.canPerformAction(loggedUser, Entity.INVOICE, Action.LINK);
+ public static canCreateTransactionInvoice(loggedUser: UserToken): boolean {
+ return Authorizations.canPerformAction(loggedUser, Entity.INVOICE, Action.CREATE);
}
public static canDownloadInvoiceBilling(loggedUser: UserToken, userId: string): boolean {

MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -62,7 +62,7 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
{ resource: Entity.BILLING, action: [Action.CHECK_CONNECTION] },
{ resource: Entity.TAXES, action: [Action.LIST], attributes: ['*'] },
{ resource: Entity.INVOICES, action: [Action.LIST, Action.SYNCHRONIZE], attributes: ['*'] },
- { resource: Entity.INVOICE, action: [Action.DOWNLOAD, Action.LINK], attributes: ['*'] },
+ { resource: Entity.INVOICE, action: [Action.DOWNLOAD, Action.CREATE], attributes: ['*'] },
{ resource: Entity.ASSET, action: [Action.CREATE, Action.READ, Action.UPDATE, Action.DELETE, Action.CHECK_CONNECTION, Action.RETRIEVE_CONSUMPTION], attributes: ['*'] },
{ resource: Entity.ASSETS, action: Action.LIST, attributes: ['*'] },
{ resource: Entity.SETTINGS, action: Action.LIST, attributes: ['*'] },

MODIFY
src/server/rest/service/BillingService.ts
src/server/rest/service/BillingService.ts
@@ -435,13 +435,13 @@ export default class BillingService {
public static async handleCreateTransactionInvoice(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
// Check if component is active
UtilsService.assertComponentIsActiveFromToken(req.user, TenantComponents.BILLING,
- Action.LINK, Entity.INVOICE, MODULE_NAME, 'handleCreateTransactionInvoice');
+ Action.CREATE, Entity.INVOICE, MODULE_NAME, 'handleCreateTransactionInvoice');
// Check Auth
- if (!Authorizations.canLinkTransactionToInvoice(req.user)) {
+ if (!Authorizations.canCreateTransactionInvoice(req.user)) {
throw new AppAuthError({
errorCode: HTTPAuthError.ERROR,
user: req.user,
- entity: Entity.INVOICE, action: Action.LINK,
+ entity: Entity.INVOICE, action: Action.CREATE,
module: MODULE_NAME, method: 'handleCreateTransactionInvoice',
});
}

MODIFY
src/types/Authorization.ts
src/types/Authorization.ts
@@ -91,7 +91,6 @@ export enum Action {
RESET = 'Reset',
ASSIGN = 'Assign',
CLEAR_CACHE = 'ClearCache',
- LINK = 'Link',
SYNCHRONIZE = 'Synchronize',
GET_CONFIGURATION = 'GetConfiguration',
CHANGE_CONFIGURATION = 'ChangeConfiguration',

Replaced LINK per CREATE