From 9263b615c281b89e9802ed7c3c17fac2ad12af79 Mon Sep 17 00:00:00 2001 From: LucasBrazi06 Date: Tue, 16 Nov 2021 11:33:13 +0100 Subject: [PATCH] Updated Authorization --- ios/Podfile.lock | 2 +- src/provider/SecurityProvider.tsx | 6 +++--- src/types/Authorization.tsx | 34 +++++++++++++------------------ 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8b3fd02b1..133c742a7 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -768,7 +768,7 @@ SPEC CHECKSUMS: DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de Fabric: ea977e3cd9c20425516d3dafd3bf8c941c51223f FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b - FBReactNativeSpec: 52a80ca1a343877d4c72738fffcf539ac4a64dec + FBReactNativeSpec: e30d74099a6ef3e67364c1ecb8ab68197a5eb022 Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193 FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd diff --git a/src/provider/SecurityProvider.tsx b/src/provider/SecurityProvider.tsx index c58da0043..1f46e4b4b 100644 --- a/src/provider/SecurityProvider.tsx +++ b/src/provider/SecurityProvider.tsx @@ -111,7 +111,7 @@ export default class SecurityProvider { } public canListUsers(): boolean { - return this.canAccess(Entity.USERS, Action.LIST); + return this.canAccess(Entity.USER, Action.LIST); } public canListTags(): boolean { @@ -123,10 +123,10 @@ export default class SecurityProvider { } public canListInvoices(): boolean { - return this.canAccess(Entity.INVOICES, Action.LIST); + return this.canAccess(Entity.INVOICE, Action.LIST); } public canListPaymentMethods(): boolean { - return this.canAccess(Entity.PAYMENT_METHODS, Action.LIST); + return this.canAccess(Entity.PAYMENT_METHOD, Action.LIST); } } diff --git a/src/types/Authorization.tsx b/src/types/Authorization.tsx index 96c23a5fd..57afcbd26 100644 --- a/src/types/Authorization.tsx +++ b/src/types/Authorization.tsx @@ -1,39 +1,33 @@ export enum Entity { SITE = 'Site', - SITES = 'Sites', SITE_AREA = 'SiteArea', - SITE_AREAS = 'SiteAreas', COMPANY = 'Company', - COMPANIES = 'Companies', CHARGING_STATION = 'ChargingStation', - CHARGING_STATIONS = 'ChargingStations', TENANT = 'Tenant', - TENANTS = 'Tenants', TRANSACTION = 'Transaction', - TRANSACTIONS = 'Transactions', - TRANSACTION_METER_VALUES = 'MeterValues', - TRANSACTION_STOP = 'Stop', REPORT = 'Report', USER = 'User', - USERS = 'Users', - TAGS = 'Tags', - VEHICLE_MANUFACTURER = 'VehicleManufacturer', - VEHICLE_MANUFACTURERS = 'VehicleManufacturers', - CARS = 'Cars', - LOGGINGS = 'Loggings', + USERS_SITES = 'UsersSites', LOGGING = 'Logging', PRICING = 'Pricing', - INVOICES = 'Invoices', - PAYMENT_METHODS = 'PaymentMethods', + PRICING_DEFINITION = 'PricingDefinition', BILLING = 'Billing', SETTING = 'Setting', - SETTINGS = 'Settings', - TOKENS = 'Tokens', TOKEN = 'Token', + ASYNC_TASK = 'AsyncTask', OCPI_ENDPOINT = 'OcpiEndpoint', - OCPI_ENDPOINTS = 'OcpiEndpoints', + OICP_ENDPOINT = 'OicpEndpoint', CONNECTION = 'Connection', - CONNECTIONS = 'Connections' + ASSET = 'Asset', + CAR_CATALOG = 'CarCatalog', + CAR = 'Car', + INVOICE = 'Invoice', + TAX = 'Tax', + REGISTRATION_TOKEN = 'RegistrationToken', + CHARGING_PROFILE = 'ChargingProfile', + NOTIFICATION = 'Notification', + TAG = 'Tag', + PAYMENT_METHOD = 'PaymentMethod', } export enum Role {