From 9b8006d6cf038e4e4a502704c6e7eefdf733cb32 Mon Sep 17 00:00:00 2001 From: SamuelTJackson <14303082+SamuelTJackson@users.noreply.github.com> Date: Tue, 13 Oct 2020 18:47:23 +0200 Subject: [PATCH] changed fiware service header to service authorization header --- config.js | 58 ++- controllers/api/permissions.js | 103 +++-- .../api/role_permission_assignments.js | 24 +- controllers/oauth2/oauth2.js | 55 +-- controllers/web/permissions.js | 26 +- etc/translations/en.json | 6 +- etc/translations/es.json | 4 +- ...107102154-CreatePermissionFiwareService.js | 9 +- ...102154-CreatePermissionUseFiwareService.js | 7 +- models/model_oauth_server.js | 42 +-- models/permission.js | 14 +- package-lock.json | 354 +++++++++++------- .../applications/handle_permissions.js | 212 +++-------- test/config/config_database.js | 21 +- test/integration/api/009-permissions.js | 86 ++--- test/integration/api/012-resource_request.js | 146 +++----- test/mysql-data/backup.sql | 6 +- test/templates/api/009-permissions.json | 30 +- test/templates/api/012-resource_request.json | 4 +- views/applications/_create_permission.ejs | 9 +- 20 files changed, 543 insertions(+), 673 deletions(-) diff --git a/config.js b/config.js index 5b15aefb..8b3c8014 100644 --- a/config.js +++ b/config.js @@ -11,26 +11,24 @@ config.https = { cert_file: 'certs/idm-2018-cert.pem', key_file: 'certs/idm-2018-key.pem', ca_certs: [], - port: 443, + port: 443 }; // Config email list type to use domain filtering config.email_list_type = null; // whitelist or blacklist // Enable 2fa authentication -config.enable_2fa = (process.env.IDM_ENABLE_2FA || false ); +config.enable_2fa = process.env.IDM_ENABLE_2FA || false; // Secret for user sessions in web config.session = { - secret: require('crypto') - .randomBytes(20) - .toString('hex'), // Must be changed - expires: 60 * 60 * 1000, // 1 hour + secret: require('crypto').randomBytes(20).toString('hex'), // Must be changed + expires: 60 * 60 * 1000 // 1 hour }; // Key to encrypt user passwords config.password_encryption = { - key: 'nodejs_idm', // Must be changed + key: 'nodejs_idm' // Must be changed }; // Enable CORS @@ -45,9 +43,9 @@ config.cors = { credentials: undefined, maxAge: undefined, preflightContinue: false, - optionsSuccessStatus: 204, + optionsSuccessStatus: 204 /* eslint-enable snakecase/snakecase */ - }, + } }; // Config oauth2 parameters @@ -56,14 +54,14 @@ config.oauth2 = { access_token_lifetime: 60 * 60, // One hour ask_authorization: true, // Prompt a message to users to allow the application to read their details refresh_token_lifetime: 60 * 60 * 24 * 14, // Two weeks - unique_url: false, // This parameter allows to verify that an application with the same url + unique_url: false // This parameter allows to verify that an application with the same url // does not exist when creating or editing it. If there are already applications // with the same URL, they should be changed manually }; // Config api parameters config.api = { - token_lifetime: 60 * 60, // One hour + token_lifetime: 60 * 60 // One hour }; // Configure Policy Decision Point (PDP) @@ -77,8 +75,8 @@ config.authorization = { authzforce: { enabled: false, host: 'localhost', - port: 8080, - }, + port: 8080 + } }; // Enable usage control and configure where is the Policy Translation Point @@ -86,18 +84,18 @@ config.usage_control = { enabled: false, ptp: { host: 'localhost', - port: 8081, - }, + port: 8081 + } }; // Database info config.database = { host: 'localhost', - password: 'idm', + password: 'test', username: 'root', database: 'idm', dialect: 'mysql', - port: undefined, + port: undefined }; // External user authentication @@ -113,21 +111,21 @@ config.external_auth = { username: 'db_user', password: 'db_pass', user_table: 'user_view', - dialect: 'mysql', - }, + dialect: 'mysql' + } }; // Email configuration config.mail = { host: 'localhost', port: 25, - from: 'noreply@localhost', + from: 'noreply@localhost' }; // Config themes config.site = { title: 'Identity Manager', - theme: 'default', + theme: 'default' }; // Config eIDAS Authentication @@ -135,7 +133,7 @@ config.eidas = { enabled: false, gateway_host: 'localhost', node_host: 'https://se-eidas.redsara.es/EidasNode/ServiceProvider', - metadata_expiration: 60 * 60 * 24 * 365, // One year + metadata_expiration: 60 * 60 * 24 * 365 // One year }; // Enables the possibility of adding identity attributes in users' profile @@ -148,35 +146,35 @@ config.identity_attributes = { key: 'vision', type: 'number', minVal: '0', - maxVal: '100', + maxVal: '100' }, { name: 'Color Perception', key: 'color', type: 'number', minVal: '0', - maxVal: '100', + maxVal: '100' }, { name: 'Hearing', key: 'hearing', type: 'number', minVal: '0', - maxVal: '100', + maxVal: '100' }, { name: 'Vocal Capability', key: 'vocal', type: 'number', minVal: '0', - maxVal: '100', + maxVal: '100' }, { name: 'Manipulation Strength', key: 'manipulation', type: 'number', minVal: '0', - maxVal: '100', + maxVal: '100' }, { name: 'Reach', key: 'reach', type: 'number', minVal: '0', maxVal: '100' }, { @@ -184,9 +182,9 @@ config.identity_attributes = { key: 'cognition', type: 'number', minVal: '0', - maxVal: '100', - }, - ], + maxVal: '100' + } + ] /* eslint-enable snakecase/snakecase */ }; diff --git a/controllers/api/permissions.js b/controllers/api/permissions.js index 2711c333..0d59b1a5 100755 --- a/controllers/api/permissions.js +++ b/controllers/api/permissions.js @@ -70,11 +70,11 @@ exports.index = function (req, res) { 'description', 'action', 'resource', - 'fiware_service', - 'use_fiware_service', - 'xml', + 'authorization_service_header', + 'use_authorization_service_header', + 'xml' ], - order: [['id', 'DESC']], + order: [['id', 'DESC']] }) .then(function (permissions) { if (permissions.length > 0) { @@ -112,8 +112,7 @@ exports.create = function (req, res) { .then(function () { // Build a row and validate if input values are correct (not empty) before saving values in permission table req.body.permission.is_regex = !!req.body.permission.is_regex; - req.body.permission.use_fiware_service = !!req.body.permission - .use_fiware_service; + req.body.permission.use_authorization_service_header = !!req.body.permission.use_authorization_service_header; const permission = models.permission.build(req.body.permission); permission.id = uuid.v4(); permission.is_internal = false; @@ -127,12 +126,12 @@ exports.create = function (req, res) { 'description', 'action', 'resource', - 'fiware_service', - 'use_fiware_service', + 'authorization_service_header', + 'use_authorization_service_header', 'xml', 'is_regex', - 'oauth_client_id', - ], + 'oauth_client_id' + ] }); }) .then(function (permission) { @@ -194,19 +193,19 @@ exports.update = function (req, res) { ? req.body.permission.is_regex : req.permission.is_regex; - req.permission.use_fiware_service = Object.prototype.hasOwnProperty.call( + req.permission.use_authorization_service_header = Object.prototype.hasOwnProperty.call( req.body.permission, - 'use_fiware_service' + 'use_authorization_service_header' ) - ? req.body.permission.use_fiware_service - : req.permission.use_fiware_service; + ? req.body.permission.use_authorization_service_header + : req.permission.use_authorization_service_header; - req.permission.fiware_service = Object.prototype.hasOwnProperty.call( + req.permission.authorization_service_header = Object.prototype.hasOwnProperty.call( req.body.permission, - 'fiware_service' + 'authorization_service_header' ) - ? req.body.permission.fiware_service - : req.permission.fiware_service; + ? req.body.permission.authorization_service_header + : req.permission.authorization_service_header; return req.permission.save(); }) @@ -303,15 +302,13 @@ function check_create_body_request(body) { if (config_authzforce.level === 'advanced') { if ( - (body.permission.resource || - body.permission.action || - body.permission.use_fiware_service) && + (body.permission.resource || body.permission.action || body.permission.use_authorization_service_header) && body.permission.xml ) { reject({ error: { message: - 'Cannot set action, resource, fiware_service and use_fiware_service at the same time as xacml rule', + 'Cannot set action, resource, authorization_service_header and use_authorization_service_header at the same time as xacml rule', code: 400, title: 'Bad Request' } @@ -351,35 +348,33 @@ function check_create_body_request(body) { } } - if (body.permission.use_fiware_service) { - if (typeof body.permission.use_fiware_service !== 'boolean') { + if (body.permission.use_authorization_service_header) { + if (typeof body.permission.use_authorization_service_header !== 'boolean') { reject({ error: { - message: 'use_fiware_service attribute must be a boolean', + message: 'use_authorization_service_header attribute must be a boolean', code: 400, - title: 'Bad Request', - }, + title: 'Bad Request' + } }); } } - if (body.permission.use_fiware_service && !body.permission.fiware_service) { + if (body.permission.use_authorization_service_header && !body.permission.authorization_service_header) { reject({ error: { - message: - 'if use_fiware_service is set, fiware_service needs to be set', + message: 'if use_authorization_service_header is set, authorization_service_header needs to be set', code: 400, - title: 'Bad Request', - }, + title: 'Bad Request' + } }); } - if (!body.permission.use_fiware_service && body.permission.fiware_service) { + if (!body.permission.use_authorization_service_header && body.permission.authorization_service_header) { reject({ error: { - message: - 'if fiware_service is set, use_fiware_service needs to be set', + message: 'if authorization_service_header is set, use_authorization_service_header needs to be set', code: 400, - title: 'Bad Request', - }, + title: 'Bad Request' + } }); } resolve(); @@ -431,15 +426,13 @@ function check_update_body_request(body) { if (config_authzforce.level === 'advanced') { if ( - (body.permission.resource || - body.permission.action || - body.permission.use_fiware_service) && + (body.permission.resource || body.permission.action || body.permission.use_authorization_service_header) && body.permission.xml ) { reject({ error: { message: - 'Cannot set action, resource, fiware_service and use_fiware_service at the same time as xacml rule', + 'Cannot set action, resource, authorization_service_header and use_authorization_service_header at the same time as xacml rule', code: 400, title: 'Bad Request' } @@ -459,35 +452,33 @@ function check_update_body_request(body) { } } - if (body.permission.use_fiware_service) { - if (typeof body.permission.use_fiware_service !== 'boolean') { + if (body.permission.use_authorization_service_header) { + if (typeof body.permission.use_authorization_service_header !== 'boolean') { reject({ error: { - message: 'use_fiware_service attribute must be a boolean', + message: 'use_authorization_service_header attribute must be a boolean', code: 400, - title: 'Bad Request', - }, + title: 'Bad Request' + } }); } } - if (body.permission.use_fiware_service && !body.permission.fiware_service) { + if (body.permission.use_authorization_service_header && !body.permission.authorization_service_header) { reject({ error: { - message: - 'if use_fiware_service is set, fiware_service needs to be set', + message: 'if use_authorization_service_header is set, authorization_service_header needs to be set', code: 400, - title: 'Bad Request', - }, + title: 'Bad Request' + } }); } - if (!body.permission.use_fiware_service && body.permission.fiware_service) { + if (!body.permission.use_authorization_service_header && body.permission.authorization_service_header) { reject({ error: { - message: - 'if fiware_service is set, use_fiware_service needs to be set', + message: 'if authorization_service_header is set, use_authorization_service_header needs to be set', code: 400, - title: 'Bad Request', - }, + title: 'Bad Request' + } }); } resolve(); diff --git a/controllers/api/role_permission_assignments.js b/controllers/api/role_permission_assignments.js index 8432e373..48a00641 100755 --- a/controllers/api/role_permission_assignments.js +++ b/controllers/api/role_permission_assignments.js @@ -23,12 +23,12 @@ exports.index = function (req, res) { 'description', 'action', 'resource', - 'fiware_service', - 'use_fiware_service', - 'xml', - ], - }, - ], + 'authorization_service_header', + 'use_authorization_service_header', + 'xml' + ] + } + ] }) .then(function (rows) { if (rows.length > 0) { @@ -199,12 +199,12 @@ function search_role_permission(application_id) { 'description', 'action', 'resource', - 'fiware_service', - 'use_fiware_service', - 'xml', - ], - }, - ], + 'authorization_service_header', + 'use_authorization_service_header', + 'xml' + ] + } + ] }); }); diff --git a/controllers/oauth2/oauth2.js b/controllers/oauth2/oauth2.js index 00479c3a..6627f2dc 100755 --- a/controllers/oauth2/oauth2.js +++ b/controllers/oauth2/oauth2.js @@ -352,11 +352,11 @@ exports.authenticate_token = function (req, res) { const resource = req.query.resource ? req.query.resource : undefined; const authzforce = req.query.authzforce ? req.query.authzforce : undefined; const req_app = req.query.app_id ? req.query.app_id : undefined; - const fiware_service = req.query.fiware_service - ? req.query.fiware_service + const authorization_service_header = req.query.authorization_service_header + ? req.query.authorization_service_header : undefined; - if ((action || resource || fiware_service) && authzforce) { + if ((action || resource || authorization_service_header) && authzforce) { const error = { message: 'Cannot handle 2 authentications levels at the same time', code: 400, @@ -376,21 +376,13 @@ exports.authenticate_token = function (req, res) { res, action, resource, - fiware_service, + authorization_service_header, authzforce, req_app, application.jwt_secret ); } - return authenticate_bearer( - req, - res, - action, - resource, - fiware_service, - authzforce, - req_app - ); + return authenticate_bearer(req, res, action, resource, authorization_service_header, authzforce, req_app); } const message = { @@ -412,30 +404,13 @@ exports.authenticate_token = function (req, res) { }; // Authenticate an incoming Json Web Token -function authenticate_jwt( - req, - res, - action, - resource, - fiware_service, - authzforce, - req_app, - jwt_secret -) { +function authenticate_jwt(req, res, action, resource, authorization_service_header, authzforce, req_app, jwt_secret) { debug(' --> authenticate_jwt'); jsonwebtoken.verify(req.query.access_token, jwt_secret, function (err, decoded) { if (err) { debug('Error ' + err); - authenticate_bearer( - req, - res, - action, - resource, - fiware_service, - authzforce, - req_app - ); + authenticate_bearer(req, res, action, resource, authorization_service_header, authzforce, req_app); } else { const identity = { username: decoded.username, @@ -452,11 +427,11 @@ function authenticate_jwt( application_id, action, resource, - fiware_service, + authorization_service_header, authzforce, req_app ) - .then(function(response) { + .then(function (response) { return res.status(200).json(response); }) .catch(function (error) { @@ -469,15 +444,7 @@ function authenticate_jwt( } // Authenticate an incoming Bearer Token -function authenticate_bearer( - req, - res, - action, - resource, - fiware_service, - authzforce, - req_app -) { +function authenticate_bearer(req, res, action, resource, authorization_service_header, authzforce, req_app) { debug(' --> authenticate_bearer'); const options = { allowBearerTokensInQueryString: true // eslint-disable-line snakecase/snakecase @@ -502,7 +469,7 @@ function authenticate_bearer( application_id, action, resource, - fiware_service, + authorization_service_header, authzforce, req_app ); diff --git a/controllers/web/permissions.js b/controllers/web/permissions.js index a82eedfe..3b1727e5 100755 --- a/controllers/web/permissions.js +++ b/controllers/web/permissions.js @@ -27,8 +27,8 @@ exports.create_permission = function (req, res) { description: req.body.description, action: req.body.action, resource: req.body.resource, - fiware_service: req.body.fiware_service, - use_fiware_service: req.body.use_fiware_service, + authorization_service_header: req.body.authorization_service_header, + use_authorization_service_header: req.body.use_authorization_service_header, is_regex: req.body.is_regex, xml: config_authzforce.level === 'advanced' ? req.body.xml : undefined, oauth_client_id: req.application.id @@ -68,12 +68,12 @@ exports.create_permission = function (req, res) { 'description', 'action', 'resource', - 'fiware_service', - 'use_fiware_service', + 'authorization_service_header', + 'use_authorization_service_header', 'is_regex', 'xml', - 'oauth_client_id', - ], + 'oauth_client_id' + ] }) .then(function () { // Send message of success of creating permission @@ -138,8 +138,8 @@ exports.edit_permission = function (req, res) { name: req.body.name, description: req.body.description, resource: req.body.resource, - fiware_service: req.body.fiware_service, - use_fiware_service: req.body.use_fiware_service, + authorization_service_header: req.body.authorization_service_header, + use_authorization_service_header: req.body.use_authorization_service_header, is_regex: req.body.is_regex, action: req.body.action, xml: config_authzforce.level === 'advanced' ? req.body.xml : undefined, @@ -176,8 +176,8 @@ exports.edit_permission = function (req, res) { name: req.body.name, description: req.body.description, resource: req.body.resource, - fiware_service: req.body.fiware_service, - use_fiware_service: req.body.use_fiware_service, + authorization_service_header: req.body.authorization_service_header, + use_authorization_service_header: req.body.use_authorization_service_header, is_regex: req.body.is_regex, action: req.body.action, xml: config_authzforce.level === 'advanced' ? req.body.xml : undefined @@ -188,10 +188,10 @@ exports.edit_permission = function (req, res) { 'description', 'action', 'resource', - 'fiware_service', - 'use_fiware_service', + 'authorization_service_header', + 'use_authorization_service_header', 'is_regex', - 'xml', + 'xml' ], where: { id: req.permission.id, diff --git a/etc/translations/en.json b/etc/translations/en.json index daf360f7..c3ed4eb8 100755 --- a/etc/translations/en.json +++ b/etc/translations/en.json @@ -594,7 +594,7 @@ }, "create_permission": { "title": "Create permission", - "subtitle01": "HTTP Verb and Resource Rule", + "subtitle01": "HTTP Verb, Resource Rule and Authorization Service Header", "subtitle02": "Advanced XACML Rule", "save_btn": "Save", "alert01": "If you use the advanced rule you cannot set also action and resource.", @@ -604,8 +604,8 @@ "label02": "Description", "label03": "HTTP action", "label04": "Resource", - "label06": "Fiware Service Header", - "label_use_fiware_service": "Use Fiware Service Header", + "label06": "Authorization Service Header", + "label_use_authorization_service_header": "Use Authorization Service Header", "label_is_regex": "Is regular expression?", "label05": "Use XACML to define a more complex authorization policy.", "required_field": "This is a required field." diff --git a/etc/translations/es.json b/etc/translations/es.json index d8268096..1557b9ea 100755 --- a/etc/translations/es.json +++ b/etc/translations/es.json @@ -604,8 +604,8 @@ "label02": "Descripción", "label03": "Acción HTTP", "label04": "Recurso", - "label06": "Fiware Service Cabecera", - "label_use_fiware_service": "Use Fiware Service Cabecera", + "label06": "Authorization Service Header", + "label_use_authorization_service_header": "Use Authorization Service Header", "label_is_regex": "¿Es una expresion regular?", "label05": "Use XACML para definir una regla de autorización mas compleja.", "required_field": "Este campo es obligatorio." diff --git a/migrations/20200107102154-CreatePermissionFiwareService.js b/migrations/20200107102154-CreatePermissionFiwareService.js index c64a03a9..b26ce06e 100644 --- a/migrations/20200107102154-CreatePermissionFiwareService.js +++ b/migrations/20200107102154-CreatePermissionFiwareService.js @@ -2,13 +2,10 @@ module.exports = { up: (queryInterface, Sequelize) => - queryInterface.addColumn('permission', 'fiware_service', { + queryInterface.addColumn('permission', 'authorization_service_header', { type: Sequelize.STRING(255) + - (queryInterface.sequelize.dialect === 'mysql' - ? ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci' - : ''), + (queryInterface.sequelize.dialect === 'mysql' ? ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci' : '') }), - down: (queryInterface, Sequelize) => - queryInterface.removeColumn('permission', 'fiware_service'), + down: (queryInterface, Sequelize) => queryInterface.removeColumn('permission', 'authorization_service_header') }; diff --git a/migrations/20200107102154-CreatePermissionUseFiwareService.js b/migrations/20200107102154-CreatePermissionUseFiwareService.js index 6403e9a6..9c02bbb5 100644 --- a/migrations/20200107102154-CreatePermissionUseFiwareService.js +++ b/migrations/20200107102154-CreatePermissionUseFiwareService.js @@ -2,11 +2,10 @@ module.exports = { up: (queryInterface, Sequelize) => - queryInterface.addColumn('permission', 'use_fiware_service', { + queryInterface.addColumn('permission', 'use_authorization_service_header', { type: Sequelize.BOOLEAN, allowNull: false, - defaultValue: false, + defaultValue: false }), - down: (queryInterface, Sequelize) => - queryInterface.removeColumn('permission', 'use_fiware_service'), + down: (queryInterface, Sequelize) => queryInterface.removeColumn('permission', 'use_authorization_service_header') }; diff --git a/models/model_oauth_server.js b/models/model_oauth_server.js index 6db3b9c6..270180d6 100755 --- a/models/model_oauth_server.js +++ b/models/model_oauth_server.js @@ -527,7 +527,7 @@ function create_oauth_response( application_id, action, resource, - fiware_service, + authorization_service_header, authzforce, req_app ) { @@ -546,7 +546,7 @@ function create_oauth_response( return models.user_authorized_application .findOne({ - where: {user_id: identity.id, oauth_client_id: application_id} + where: { user_id: identity.id, oauth_client_id: application_id } }) .then(function (third_party_application) { let shared_attributes = third_party_application.shared_attributes; @@ -576,14 +576,7 @@ function create_oauth_response( user_info.eidas_profile = identity.extra.eidas_profile; } - return search_user_info( - user_info, - action, - resource, - fiware_service, - authzforce, - req_app - ); + return search_user_info(user_info, action, resource, authorization_service_header, authzforce, req_app); }); } else if (type === 'iot') { const iot_info = JSON.parse(JSON.stringify(require('../templates/oauth_response/oauth_iot_response.json'))); @@ -611,14 +604,7 @@ function search_iot_info(iot_info) { } // Check if user has enabled the application to read their details -function search_user_info( - user_info, - action, - resource, - fiware_service, - authzforce, - req_app -) { +function search_user_info(user_info, action, resource, authorization_service_header, authzforce, req_app) { debug('-------search_user_info-------'); return new Promise(function (resolve, reject) { const promise_array = []; @@ -633,14 +619,8 @@ function search_user_info( // Insert search permissions promise to generate decison if (action && resource) { - const search_permissions = search_roles.then(function(roles) { - return user_permissions( - roles.all, - user_info.app_id, - action, - resource, - fiware_service - ); + const search_permissions = search_roles.then(function (roles) { + return user_permissions(roles.all, user_info.app_id, action, resource, authorization_service_header); }); promise_array.push(search_permissions); } else if (config_authzforce.enabled && authzforce) { @@ -795,7 +775,7 @@ function user_roles(user_id, app_id) { } // Search user permissions in application whose action and resource are recieved from Pep Proxy -function user_permissions(roles_id, app_id, action, resource, fiware_service) { +function user_permissions(roles_id, app_id, action, resource, authorization_service_header) { debug('-------user_permissions-------'); return models.role_permission .findAll({ @@ -812,14 +792,14 @@ function user_permissions(roles_id, app_id, action, resource, fiware_service) { action } }) - .then(permissions => - permissions.filter(permission => { + .then((permissions) => + permissions.filter((permission) => { return ( (permission.is_regex === 1 ? new RegExp(permission.resource).exec(resource) : permission.resource === resource) && - (permission.use_fiware_service === 1 - ? permission.fiware_service === fiware_service + (permission.use_authorization_service_header === 1 + ? permission.authorization_service_header === authorization_service_header : true) ); }) diff --git a/models/permission.js b/models/permission.js index e5dc724f..ae759ea8 100755 --- a/models/permission.js +++ b/models/permission.js @@ -38,21 +38,17 @@ module.exports = function (sequelize, DataTypes) { DataTypes.STRING(255) + (sequelize.getDialect() === 'mysql' ? ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci' : '') }, - fiware_service: { + authorization_service_header: { type: DataTypes.STRING(255) + - (sequelize.getDialect() === 'mysql' - ? ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci' - : ''), + (sequelize.getDialect() === 'mysql' ? ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci' : '') }, - use_fiware_service: { + use_authorization_service_header: { type: DataTypes.BOOLEAN() + - (sequelize.getDialect() === 'mysql' - ? ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci' - : ''), + (sequelize.getDialect() === 'mysql' ? ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci' : ''), allowNull: false, - default: false, + default: false }, is_regex: { type: diff --git a/package-lock.json b/package-lock.json index 79b9b48a..80bf668c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -702,9 +702,9 @@ } }, "@sinonjs/samsam": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.1.0.tgz", - "integrity": "sha512-42nyaQOVunX5Pm6GRJobmzbS7iLI+fhERITnETXzzwDZh+TtDr/Au3yAvXVjFmZ4wEUaE4Y3NFZfKv0bV0cbtg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.2.0.tgz", + "integrity": "sha512-CaIcyX5cDsjcW/ab7HposFWzV1kC++4HNsfnEdFJa7cP1QIuILAKV+BgfeqRXhcnSAc76r/Rh/O5C+300BwUIw==", "dev": true, "requires": { "@sinonjs/commons": "^1.6.0", @@ -1141,20 +1141,15 @@ "integrity": "sha512-KmU+kGi7vG5toUhNdLHHPxyVN1mNGcjMVe1tNDEXT1wU/3oqA96bunElrROWHYw5iNt1QVRaIAtNeMVyzyAdVA==", "dev": true }, - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" - }, "@types/geojson": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-1.0.6.tgz", - "integrity": "sha1-PgKXJyjGkkjCrwjWCkjLuGgP/98=" + "integrity": "sha512-Xqg/lIZMrUd0VRmSRbCAewtwGZiAk3mEUDvV4op1tGl+LvyPcb/MIOSxTl9z+9+J+R4/vpjiCAT4xeKzH9ji1w==" }, "@types/node": { - "version": "14.11.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.2.tgz", - "integrity": "sha512-jiE3QIxJ8JLNcb1Ps6rDbysDhN4xa8DJJvuC9prr6w+1tIh+QAbYyNF3tyiZNLDBIuBCf4KEcV2UvQm/V60xfA==" + "version": "14.11.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.8.tgz", + "integrity": "sha512-KPcKqKm5UKDkaYPTuXSx8wEP7vE9GnuaXIZKijwRYcePpZFDVuy2a57LarFKiORbHOuTOOwYzxVxcUzsh2P2Pw==" }, "@types/parse-json": { "version": "4.0.0", @@ -1176,7 +1171,7 @@ "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha1-+PLIh60Qv2f2NPAFtph/7TF5qsg=" + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "accepts": { "version": "1.3.7", @@ -1188,9 +1183,9 @@ } }, "acorn": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", - "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==" + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" }, "acorn-globals": { "version": "6.0.0", @@ -1254,9 +1249,9 @@ } }, "ajv": { - "version": "6.12.5", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", - "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1304,11 +1299,10 @@ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, @@ -2144,7 +2138,7 @@ "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha1-4TjMdeBAxyexlm/l5fjJruJW/js=" + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" }, "convert-source-map": { "version": "1.7.0", @@ -2421,7 +2415,7 @@ "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" }, @@ -2503,7 +2497,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -2516,6 +2509,13 @@ "ast-types": "0.x.x", "escodegen": "1.x.x", "esprima": "3.x.x" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + } } }, "delayed-stream": { @@ -2549,9 +2549,9 @@ "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, "device-detector-js": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/device-detector-js/-/device-detector-js-2.2.2.tgz", - "integrity": "sha512-e3fcxyP/dQanWDaFa4eC1s2m6Uv2vMWoqSdk95kJeqS9GALXTnBaOYxLOzQjqCQq5ZMRkDVhvZQgN4oGvRZtjA==" + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/device-detector-js/-/device-detector-js-2.2.5.tgz", + "integrity": "sha512-TW9TJRjzCv0TD5hKiVcgqxq5egT14NVwPg7jBv84h4qjpc4weVtEuYEtMfgtXAsV+NUU9oKSme2Gvm4nSoNn+A==" }, "dicer": { "version": "0.2.5", @@ -2787,22 +2787,52 @@ } }, "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", + "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", + "is-callable": "^1.2.2", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", + "object.assign": "^4.1.1", "string.prototype.trimend": "^1.0.1", "string.prototype.trimstart": "^1.0.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "object.assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", + "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "requires": { + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } } }, "es-array-method-boxes-properly": { @@ -2838,7 +2868,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -2924,25 +2953,12 @@ "esutils": "^2.0.2", "optionator": "^0.8.1", "source-map": "~0.6.1" - }, - "dependencies": { - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "optional": true - } } }, "eslint": { - "version": "7.10.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.10.0.tgz", - "integrity": "sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.11.0.tgz", + "integrity": "sha512-G9+qtYVCHaDi1ZuWzBsOWo2wSwd70TXnU6UHA3cTYHp7gCTXZcpggWFoUVAMRarg68qtPoNfFbzPh+VdOgmwmw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -2955,7 +2971,7 @@ "enquirer": "^2.3.5", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^1.3.0", + "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.0", "esquery": "^1.2.0", "esutils": "^2.0.2", @@ -3165,12 +3181,20 @@ "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } } }, "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", "dev": true }, "espree": { @@ -3182,12 +3206,20 @@ "acorn": "^7.4.0", "acorn-jsx": "^5.2.0", "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } } }, "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esquery": { "version": "1.3.1", @@ -3736,7 +3768,7 @@ "fs-extra": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", - "integrity": "sha1-QU0BEM3QZwVzTQVWUsVBEmDDGr0=", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -3809,8 +3841,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "functional-red-black-tree": { "version": "1.0.1", @@ -4023,7 +4054,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -4045,8 +4075,7 @@ "has-symbols": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==" }, "has-unicode": { "version": "2.0.1", @@ -4054,9 +4083,9 @@ "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, "hasha": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.1.tgz", - "integrity": "sha512-x15jnRSHTi3VmH+oHtVb9kgU/HuKOK8mjK8iCL3dPQXh4YJlUb9YSI8ZLiiqLAIvY2wuDIlZYZppy8vB2XISkQ==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", "dev": true, "requires": { "is-stream": "^2.0.0", @@ -4376,7 +4405,7 @@ "ini": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha1-7uJfVtscnsYIXgwid4CD9Zar+Sc=" + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, "invert-kv": { "version": "1.0.0", @@ -4454,14 +4483,12 @@ "is-callable": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", - "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", - "dev": true + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==" }, "is-date-object": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==" }, "is-decimal": { "version": "1.0.4", @@ -4536,6 +4563,11 @@ "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", "dev": true }, + "is-negative-zero": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", + "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=" + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -4573,7 +4605,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", - "dev": true, "requires": { "has-symbols": "^1.0.1" } @@ -4605,7 +4636,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, "requires": { "has-symbols": "^1.0.1" } @@ -4811,12 +4841,6 @@ "requires": { "ms": "2.1.2" } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true } } }, @@ -4909,14 +4933,6 @@ "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" - }, - "dependencies": { - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - } } }, "jsbn": { @@ -4955,18 +4971,6 @@ "whatwg-url": "^8.0.0", "ws": "^7.2.3", "xml-name-validator": "^3.0.0" - }, - "dependencies": { - "tough-cookie": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", - "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", - "requires": { - "ip-regex": "^2.1.0", - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - } } }, "jsesc": { @@ -5960,7 +5964,7 @@ "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha1-ggyGo5M0ZA6ZUWkovQP8qIBX0CI=" + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" }, "min-document": { "version": "2.19.0", @@ -5973,7 +5977,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { "brace-expansion": "^1.1.7" } @@ -6295,9 +6299,9 @@ "dev": true }, "moment": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.0.tgz", - "integrity": "sha512-z6IJ5HXYiuxvFTI6eiQ9dm77uE0gyy1yXNApVHqTcnIKfY9tIwEjlzsZ6u1LQXvVgKeTnv9Xm7NDvJ7lso3MtA==" + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, "moment-timezone": { "version": "0.5.31", @@ -6810,7 +6814,7 @@ "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, "oauth2-server": { - "version": "git+https://github.com/ging/node-oauth2-server.git#32ed5b6ba15bf263fbc0c81df0de887dd039ffc2", + "version": "git+https://github.com/ging/node-oauth2-server.git#28d7db9bb6d49e61bb8c3e6188d5cd264468eacf", "from": "git+https://github.com/ging/node-oauth2-server.git#4.2", "requires": { "basic-auth": "1.1.0", @@ -6861,24 +6865,56 @@ "object-inspect": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", - "dev": true + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==" }, "object-is": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.2.tgz", - "integrity": "sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.3.tgz", + "integrity": "sha512-teyqLvFWzLkq5B9ki8FVWA902UER2qkxmdA4nLf+wjOLAWgxzCWZNCxpDq9MvE8MmhWNr+I8w3BN49Vx36Y6Xg==", "dev": true, "requires": { "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" + "es-abstract": "^1.18.0-next.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "object.assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", + "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.0", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } } }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" }, "object.assign": { "version": "4.1.0", @@ -7063,13 +7099,13 @@ } }, "p-queue": { - "version": "6.6.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.1.tgz", - "integrity": "sha512-miQiSxLYPYBxGkrldecZC18OTLjdUqnlRebGzPRiVxB8mco7usCmm7hFuxiTvp93K18JnLtE4KMMycjAu/cQQg==", + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", + "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", "dev": true, "requires": { "eventemitter3": "^4.0.4", - "p-timeout": "^3.1.0" + "p-timeout": "^3.2.0" } }, "p-timeout": { @@ -8308,6 +8344,17 @@ "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" + }, + "dependencies": { + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } } }, "request-promise-core": { @@ -8326,6 +8373,17 @@ "request-promise-core": "1.1.4", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" + }, + "dependencies": { + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } } }, "require-directory": { @@ -8400,9 +8458,9 @@ }, "dependencies": { "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true } } @@ -8563,7 +8621,7 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk=" + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "saxes": { "version": "5.0.1", @@ -8580,6 +8638,16 @@ "requires": { "js-base64": "^2.1.8", "source-map": "^0.4.2" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "requires": { + "amdefine": ">=0.0.4" + } + } } }, "semver": { @@ -8917,7 +8985,7 @@ "serve-favicon": { "version": "2.4.5", "resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.4.5.tgz", - "integrity": "sha1-SdmkaGMVOpJAaRyJPSsOfYXW1DY=", + "integrity": "sha512-s7F8h2NrslMkG50KxvlGdj+ApSwaLex0vexuJ9iFf3GLTIp1ph/l1qZvRe9T9TJEYZgmq72ZwJ2VYiAEtChknw==", "requires": { "etag": "~1.8.1", "fresh": "0.5.2", @@ -9183,12 +9251,9 @@ } }, "source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", - "requires": { - "amdefine": ">=0.0.4" - } + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "spawn-wrap": { "version": "2.0.0", @@ -9344,7 +9409,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", - "dev": true, "requires": { "define-properties": "^1.1.3", "es-abstract": "^1.17.5" @@ -9354,7 +9418,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", - "dev": true, "requires": { "define-properties": "^1.1.3", "es-abstract": "^1.17.5" @@ -9948,7 +10011,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "thunkify": { @@ -10023,10 +10086,11 @@ "integrity": "sha1-f/0feMi+KMO6Rc1OGj9e4ZO9mYg=" }, "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", + "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", "requires": { + "ip-regex": "^2.1.0", "psl": "^1.1.28", "punycode": "^2.1.1" } @@ -10083,9 +10147,9 @@ "dev": true }, "tslib": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", - "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", + "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==" }, "tsscmp": { "version": "1.0.6", @@ -10659,9 +10723,9 @@ "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" }, "whatwg-url": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.3.0.tgz", - "integrity": "sha512-BQRf/ej5Rp3+n7k0grQXZj9a1cHtsp4lqj01p59xBWFKdezR8sO37XnpafwNqiFac/v2Il12EIMjX/Y4VZtT8Q==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.4.0.tgz", + "integrity": "sha512-vwTUFf6V4zhcPkWp/4CQPr1TW9Ml6SF4lVyaIMBdJw5i6qUUJ1QWM4Z6YYVkfka0OUIzVo/0aNtGVGk256IKWw==", "requires": { "lodash.sortby": "^4.7.0", "tr46": "^2.0.2", @@ -10926,7 +10990,7 @@ "xpath.js": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", - "integrity": "sha1-OBakTtS7NSCRCD0AKjg91RBKX/E=" + "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" }, "xregexp": { "version": "2.0.0", diff --git a/public/javascripts/applications/handle_permissions.js b/public/javascripts/applications/handle_permissions.js index 8a9651c2..94d29127 100755 --- a/public/javascripts/applications/handle_permissions.js +++ b/public/javascripts/applications/handle_permissions.js @@ -1,15 +1,10 @@ // Handle button clicks and asynchronous request to the server in order to create permissions -$(document).ready(function() { +$(document).ready(function () { // Select permission item from list - $('#update_owners_permissions').on('click', '.list-group-item', function(e) { - if ( - $(e.target).hasClass('fa-edit') === false && - $(e.target).hasClass('fa-trash-alt') === false - ) { - var role = $('#update_owners_roles') - .find('div.active') - .attr('id'); + $('#update_owners_permissions').on('click', '.list-group-item', function (e) { + if ($(e.target).hasClass('fa-edit') === false && $(e.target).hasClass('fa-trash-alt') === false) { + var role = $('#update_owners_roles').find('div.active').attr('id'); if (!['provider', 'purchaser'].includes(role)) { var permission = $(this).attr('data-permission-id'); @@ -30,27 +25,22 @@ $(document).ready(function() { } }); - $('#permButton').click(function() { - var action = - '/idm/applications/' + application.id + '/edit/permissions/create'; + $('#permButton').click(function () { + var action = '/idm/applications/' + application.id + '/edit/permissions/create'; $('#create_permission_form').attr('action', action); }); // Exit from form to create new permission - $('#esc_perm_creation').click(function() { + $('#esc_perm_creation').click(function () { exit_permission_form(); }); function htmlEntities(str) { - return String(str) - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); + return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } // Handle the submit button from the create permission - $('#create_permission_form').submit(function(event) { + $('#create_permission_form').submit(function (event) { // stop form from submitting normally event.preventDefault(); @@ -58,41 +48,21 @@ $(document).ready(function() { var $form = $(this), url = $form.attr('action'); - var name = $(this) - .find('#id_name') - .val(); + var name = $(this).find('#id_name').val(); var body = { - name: $(this) - .find('#id_name') - .val(), - description: $(this) - .find('#id_description') - .val(), - resource: $(this) - .find('#id_resource') - .val(), + name: $(this).find('#id_name').val(), + description: $(this).find('#id_description').val(), + resource: $(this).find('#id_resource').val(), is_regex: $(this).find('#id_is_regex')[0].checked ? 1 : 0, - use_fiware_service: $(this).find('#id_use_fiware_service')[0].checked - ? 1 - : 0, - fiware_service: $(this) - .find('#id_fiware_service') - .val(), - action: $(this) - .find('#id_action') - .val(), - xml: $(this) - .find('#id_xml') - .val(), + use_authorization_service_header: $(this).find('#id_use_authorization_service_header')[0].checked ? 1 : 0, + authorization_service_header: $(this).find('#id_authorization_service_header').val(), + action: $(this).find('#id_action').val(), + xml: $(this).find('#id_xml').val() }; var method = 'POST'; - if ( - $(this) - .attr('action') - .includes('put') - ) { + if ($(this).attr('action').includes('put')) { method = 'PUT'; url = url.split('?')[0]; } @@ -101,32 +71,20 @@ $(document).ready(function() { $.ajax({ url: url, type: method, - beforeSend: before_send( - $('#create_permission_form') - .find('input:hidden[name=_csrf]') - .val() - ), + beforeSend: before_send($('#create_permission_form').find('input:hidden[name=_csrf]').val()), data: body, - success: function(result) { + success: function (result) { // See if the result of post data is an error if (result.type === 'warning') { - $('#create_permission_form') - .find('.help-block.alert.alert-danger') - .hide('close'); + $('#create_permission_form').find('.help-block.alert.alert-danger').hide('close'); for (var i = result.text.length - 1; i >= 0; i--) { $('#create_permission_form') - .find( - '#' + result.text[i].message + '.help-block.alert.alert-danger' - ) + .find('#' + result.text[i].message + '.help-block.alert.alert-danger') .show('open'); } return false; - $('#create_permission_form') - .find('.help-block.alert.alert-danger') - .hide('close'); - $('#create_permission_form') - .find('#error_invalid_inputs.help-block.alert.alert-danger') - .show('open'); + $('#create_permission_form').find('.help-block.alert.alert-danger').hide('close'); + $('#create_permission_form').find('#error_invalid_inputs.help-block.alert.alert-danger').show('open'); } else if (result.type === 'danger') { // Exit from dialog exit_permission_form(); @@ -140,21 +98,15 @@ $(document).ready(function() { if (method === 'POST') { // Create new row in permission column var permission = $('#table_row_permission_template').html(); - permission = permission.replace( - 'perm_name', - htmlEntities(result.permission.name) - ); - permission = permission.replace( - 'perm_id', - String(result.permission.id) - ); + permission = permission.replace('perm_name', htmlEntities(result.permission.name)); + permission = permission.replace('perm_id', String(result.permission.id)); $('#list_permissions').append(permission); // Add to permissions array application.permissions.push(result.permission); } else if (method === 'PUT') { var permission_id = url.split('/')[6]; - application.permissions.forEach(function(element, index) { + application.permissions.forEach(function (element, index) { if (element.id == permission_id) { application.permissions[index]['name'] = name; } @@ -173,36 +125,28 @@ $(document).ready(function() { // Add message create_message(result.message.type, result.message.text); } - }, + } }); }); // Complete form to edit a permission - $('#update_owners_permissions').on('click', '.edit_permission', function( - event - ) { + $('#update_owners_permissions').on('click', '.edit_permission', function (event) { // stop form from submitting normally event.preventDefault(); - var permission_id = $(this) - .parent() - .attr('data-permission-id'); + var permission_id = $(this).parent().attr('data-permission-id'); if (['1', '2', '3', '4', '5', '6'].includes(permission_id)) { // Add message create_message('danger', ' Not valid.'); } else { - var url = - '/idm/applications/' + - application.id + - '/edit/permissions/' + - permission_id; + var url = '/idm/applications/' + application.id + '/edit/permissions/' + permission_id; // Send put request $.ajax({ url: url, type: 'GET', - success: function(result) { + success: function (result) { if (result.type === 'danger') { // Add message create_message(result.type, result.text); @@ -210,63 +154,40 @@ $(document).ready(function() { $('#create_permission').modal('toggle'); var action = url + '/edit?method=put'; $('#create_permission_form').attr('action', action); - $('#create_permission_form') - .find('#id_name') - .val(result.name); - $('#create_permission_form') - .find('#id_description') - .val(result.description); - $('#create_permission_form') - .find('#id_action') - .val(result.action); - $('#create_permission_form') - .find('#id_resource') - .val(result.resource); + $('#create_permission_form').find('#id_name').val(result.name); + $('#create_permission_form').find('#id_description').val(result.description); + $('#create_permission_form').find('#id_action').val(result.action); + $('#create_permission_form').find('#id_resource').val(result.resource); if (result.is_regex > 0) { - $('#create_permission_form').find( - '#id_is_regex' - )[0].checked = true; + $('#create_permission_form').find('#id_is_regex')[0].checked = true; } - if (result.use_fiware_service > 0) { - $('#create_permission_form').find( - '#id_use_fiware_service' - )[0].checked = true; + if (result.use_authorization_service_header > 0) { + $('#create_permission_form').find('#id_use_authorization_service_header')[0].checked = true; } $('#create_permission_form') - .find('#id_fiware_service') - .val(result.fiware_service); - $('#create_permission_form') - .find('#id_xml') - .val(result.xml); + .find('#id_authorization_service_header') + .val(result.authorization_service_header); + $('#create_permission_form').find('#id_xml').val(result.xml); } - }, + } }); } }); // Form to delete a permission - $('#update_owners_permissions').on('click', '.delete', function(event) { + $('#update_owners_permissions').on('click', '.delete', function (event) { // Stop linking event.preventDefault(); // Change form action - var permission_id = String( - $(this) - .parent() - .attr('data-permission-id') - ); + var permission_id = String($(this).parent().attr('data-permission-id')); var app_id = String(application.id); - var action = - '/idm/applications/' + - app_id + - '/edit/permissions/' + - permission_id + - '/delete'; + var action = '/idm/applications/' + app_id + '/edit/permissions/' + permission_id + '/delete'; $('#delete_permission_form').attr('action', action); }); // To confirm delete the permission - $('#delete_permission_form').submit(function(event) { + $('#delete_permission_form').submit(function (event) { // stop form from submitting normally event.preventDefault(); @@ -281,25 +202,21 @@ $(document).ready(function() { url: url, type: 'DELETE', beforeSend: before_send($('input:hidden[name=_csrf]').val()), - success: function(result) { + success: function (result) { if (result.type === 'success') { $('#update_owners_permissions') .find('[data-permission-id=' + permission_id + ']') .remove(); delete application.role_permission_assign[permission_id]; for (var role in application.role_permission_assign) { - application.role_permission_assign[ - role - ] = application.role_permission_assign[role].filter(function( + application.role_permission_assign[role] = application.role_permission_assign[role].filter(function ( permission ) { return permission !== permission_id; }); } - application.permissions = application.permissions.filter(function( - elem - ) { + application.permissions = application.permissions.filter(function (elem) { return elem.id !== permission_id; }); $('#update_owners_permissions').hide('close'); @@ -311,7 +228,7 @@ $(document).ready(function() { // Exit from dialog $('#delete_permission').modal('toggle'); - }, + } }); }); }); @@ -319,29 +236,16 @@ $(document).ready(function() { // Function to put back the default permission form function exit_permission_form() { // Empty input from role creation form - var action = - '/idm/applications/' + application.id + '/edit/permissions/create'; + var action = '/idm/applications/' + application.id + '/edit/permissions/create'; $('#create_permission_form').attr('action', action); - $('#create_permission_form') - .find('#id_name') - .val(''); - $('#create_permission_form') - .find('#id_description') - .val(''); - $('#create_permission_form') - .find('#id_action') - .val(''); - $('#create_permission_form') - .find('#id_resource') - .val(''); - $('#create_permission_form') - .find('#id_xml') - .val(''); + $('#create_permission_form').find('#id_name').val(''); + $('#create_permission_form').find('#id_description').val(''); + $('#create_permission_form').find('#id_action').val(''); + $('#create_permission_form').find('#id_resource').val(''); + $('#create_permission_form').find('#id_xml').val(''); // Hide error if exist - $('#create_permission_form') - .find('.help-block.alert.alert-danger') - .hide('close'); + $('#create_permission_form').find('.help-block.alert.alert-danger').hide('close'); } // Function to create messages diff --git a/test/config/config_database.js b/test/config/config_database.js index 8fd09e0a..fc8d1799 100755 --- a/test/config/config_database.js +++ b/test/config/config_database.js @@ -9,28 +9,27 @@ const exec = require('child_process').exec; const config_service = require('../../lib/configService.js'); config_service.set_config(require('../config-test')); const config = config_service.get_config(); - // eslint-disable-next-line no-undef before('Create and populate database', function () { // Mocha default timeout for tests is 2000 and to create database is needed more this.timeout(10000); - return new Promise(function (resolve, reject) { const create_database = - 'sudo mysql -u ' + + 'mysql --user=' + config.database.username + - ' -p' + + ' --password=' + config.database.password + " -e 'CREATE DATABASE IF NOT EXISTS idm_test;'"; const load_data = - 'sudo mysql -u ' + + 'mysql --user=' + config.database.username + - ' -p' + + ' --password=' + config.database.password + - ' --default-character-set=utf8 idm_test < test/mysql-data/backup.sql'; + //' --default-character-set=utf8 idm_test < test/mysql-data/backup.sql'; + ' --default-character-set=utf8 -e "$(cat test/mysql-data/backup.sql)"'; exec(create_database, function (error) { if (error) { - // console.log(error); + console.log(error); process.exit(); reject('Unable to create test database: ', error); } else { @@ -53,7 +52,11 @@ before('Create and populate database', function () { after('Delete database', function () { return new Promise(function (resolve, reject) { const load_data = - 'mysql -u ' + config.database.username + ' -p' + config.database.password + " -e 'DROP DATABASE idm_test;'"; + 'mysql --user=' + + config.database.username + + ' --password=' + + config.database.password + + " -e 'DROP DATABASE idm_test;'"; exec(load_data, function (error) { if (error) { process.exit(); diff --git a/test/integration/api/009-permissions.js b/test/integration/api/009-permissions.js index 63173067..62cdfef2 100755 --- a/test/integration/api/009-permissions.js +++ b/test/integration/api/009-permissions.js @@ -167,9 +167,9 @@ describe('API - 9 - Permissions: ', function () { let permission_resource; let permission_action; // eslint-disable-next-line no-unused-vars - let permission_fiware_service; + let permission_authorization_service_header; // eslint-disable-next-line no-unused-vars - let permission_use_fiware_service; + let permission_use_authorization_service_header; // eslint-disable-next-line snakecase/snakecase beforeEach(function (done) { const create_permission = { @@ -189,8 +189,10 @@ describe('API - 9 - Permissions: ', function () { permission_description = json.permission.description; permission_action = json.permission.action; permission_resource = json.permission.resource; - permission_fiware_service = json.fiware_service; - permission_use_fiware_service = json.use_fiware_service; + // eslint-disable-next-line no-unused-vars + permission_authorization_service_header = json.authorization_service_header; + // eslint-disable-next-line no-unused-vars + permission_use_authorization_service_header = json.use_authorization_service_header; done(); }); }); @@ -214,15 +216,14 @@ describe('API - 9 - Permissions: ', function () { const response_description = json.values_updated.description; const response_action = json.values_updated.action; const response_resource = json.values_updated.resource; - const response_fiware_service = json.values_updated.fiware_service; - const response_use_fiware_service = - json.values_updated.use_fiware_service; + const response_authorization_service_header = json.values_updated.authorization_service_header; + const response_use_authorization_service_header = json.values_updated.use_authorization_service_header; should.notEqual(permission_name, response_name); should.notEqual(permission_description, response_description); should.notEqual(permission_action, response_action); should.notEqual(permission_resource, response_resource); - should.equal(undefined, response_fiware_service); - should.equal(false, response_use_fiware_service); + should.equal(undefined, response_authorization_service_header); + should.equal(false, response_use_authorization_service_header); response.statusCode.should.equal(200); done(); }); @@ -268,108 +269,101 @@ describe('API - 9 - Permissions: ', function () { }); }); }); -describe('7) When creating a permission with resource+password+use_fiware_service and no fiware_service', function() { - it('should return a 400 Bad request', function(done) { +describe('7) When creating a permission with resource+password+use_authorization_service_header and no authorization_service_header', function () { + it('should return a 400 Bad request', function (done) { const create_permission = { url: config.host + '/v1/applications/' + application_id + '/permissions', method: 'POST', body: JSON.stringify( - permissions.create - .invalid_perm_body_no_fiware_service_but_use_fiware_service + permissions.create.invalid_perm_body_no_authorization_service_header_but_use_authorization_service_header ), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_permission, function(error, response) { + request(create_permission, function (error, response) { should.not.exist(error); response.statusCode.should.equal(400); done(); }); }); }); -describe('8) When creating a permission with resource+password+fiware_service and no use_fiware_service', function() { - it('should return a 400 Bad request', function(done) { +describe('8) When creating a permission with resource+password+authorization_service_header and no use_authorization_service_header', function () { + it('should return a 400 Bad request', function (done) { const create_permission = { url: config.host + '/v1/applications/' + application_id + '/permissions', method: 'POST', body: JSON.stringify( - permissions.create - .invalid_perm_body_no_use_fiware_service_but_fiware_service + permissions.create.invalid_perm_body_no_use_authorization_service_header_but_authorization_service_header ), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_permission, function(error, response) { + request(create_permission, function (error, response) { should.not.exist(error); response.statusCode.should.equal(400); done(); }); }); }); -describe('9) When creating a permission with fiware_service and xml in body', function() { - it('should return a 400 Bad request', function(done) { +describe('9) When creating a permission with authorization_service_header and xml in body', function () { + it('should return a 400 Bad request', function (done) { const create_permission = { url: config.host + '/v1/applications/' + application_id + '/permissions', method: 'POST', - body: JSON.stringify( - permissions.create.invalid_perm_body_fiware_service_and_xml - ), + body: JSON.stringify(permissions.create.invalid_perm_body_authorization_service_header_and_xml), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_permission, function(error, response) { + request(create_permission, function (error, response) { should.not.exist(error); response.statusCode.should.equal(400); done(); }); }); }); -describe('10) When creating a permission with use_fiware_service and xml in body', function() { - it('should return a 400 Bad request', function(done) { +describe('10) When creating a permission with use_authorization_service_header and xml in body', function () { + it('should return a 400 Bad request', function (done) { const create_permission = { url: config.host + '/v1/applications/' + application_id + '/permissions', method: 'POST', - body: JSON.stringify( - permissions.create.invalid_perm_body_use_fiware_service_and_xml - ), + body: JSON.stringify(permissions.create.invalid_perm_body_use_authorization_service_header_and_xml), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_permission, function(error, response) { + request(create_permission, function (error, response) { should.not.exist(error); response.statusCode.should.equal(400); done(); }); }); }); -describe('11) When creating a permission with use_fiware_service equal false', function() { - it('should return a 201 OK', function(done) { +describe('11) When creating a permission with use_authorization_service_header equal false', function () { + it('should return a 201 OK', function (done) { const create_permission = { url: config.host + '/v1/applications/' + application_id + '/permissions', method: 'POST', body: JSON.stringify( - permissions.create - .valid_perm_body_no_fiware_service_but_use_fiware_service_is_false + permissions.create.valid_perm_body_no_authorization_service_header_but_use_authorization_service_header_is_false ), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_permission, function(error, response) { + request(create_permission, function (error, response) { should.not.exist(error); response.statusCode.should.equal(201); done(); diff --git a/test/integration/api/012-resource_request.js b/test/integration/api/012-resource_request.js index a60e4bad..131d5cd2 100755 --- a/test/integration/api/012-resource_request.js +++ b/test/integration/api/012-resource_request.js @@ -14,12 +14,8 @@ const should = require('should'); const request = require('request'); const utils = require('../../utils'); -const login = utils.readExampleFile( - './test/templates/api/000-authenticate.json' -).good_admin_login; -const resource_requests = utils.readExampleFile( - './test/templates/api/012-resource_request.json' -); +const login = utils.readExampleFile('./test/templates/api/000-authenticate.json').good_admin_login; +const resource_requests = utils.readExampleFile('./test/templates/api/012-resource_request.json'); let token; let application_id; @@ -29,19 +25,19 @@ let permissions_id_1; let permissions_id_2; let role_id; -describe('API - 12 - fiware service permission request: ', function() { +describe('API - 12 - Authorization Service Header permission request: ', function () { // CREATE TOKEN WITH PROVIDER CREDENTIALS // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const good_login = { url: config.host + '/v1/auth/tokens', method: 'POST', json: login, headers: { - 'Content-Type': 'application/json', - }, + 'Content-Type': 'application/json' + } }; - return request(good_login, function(error, response) { + return request(good_login, function (error, response) { token = response.headers['x-subject-token']; done(); }); @@ -49,18 +45,18 @@ describe('API - 12 - fiware service permission request: ', function() { // CREATE APPLICATION // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const create_application = { url: config.host + '/v1/applications', method: 'POST', body: JSON.stringify(resource_requests.before), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_application, function(error, response, body) { + request(create_application, function (error, response, body) { const json = JSON.parse(body); application_id = json.application.id; application_secret = json.application.secret; @@ -70,18 +66,18 @@ describe('API - 12 - fiware service permission request: ', function() { // CREATE PERMISSIONS 1 // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const create_permission1 = { url: config.host + '/v1/applications/' + application_id + '/permissions', method: 'POST', body: JSON.stringify(resource_requests.create.valid_perm_body1), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_permission1, function(error, response, body) { + request(create_permission1, function (error, response, body) { const json = JSON.parse(body); permissions_id_1 = json.permission.id; done(); @@ -89,18 +85,18 @@ describe('API - 12 - fiware service permission request: ', function() { }); // CREATE PERMISSIONS 2 // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const create_permission2 = { url: config.host + '/v1/applications/' + application_id + '/permissions', method: 'POST', body: JSON.stringify(resource_requests.create.valid_perm_body2), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_permission2, function(error, response, body) { + request(create_permission2, function (error, response, body) { const json = JSON.parse(body); permissions_id_2 = json.permission.id; done(); @@ -108,18 +104,18 @@ describe('API - 12 - fiware service permission request: ', function() { }); // CREATE ROLE // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const create_permission2 = { url: config.host + '/v1/applications/' + application_id + '/roles', method: 'POST', body: JSON.stringify(resource_requests.create.valid_role_body), headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(create_permission2, function(error, response, body) { + request(create_permission2, function (error, response, body) { const json = JSON.parse(body); role_id = json.role.id; done(); @@ -127,53 +123,41 @@ describe('API - 12 - fiware service permission request: ', function() { }); // ASSIGN PERMISSION 1 TO ROLE // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const assign_permission_1_to_role = { url: - config.host + - '/v1/applications/' + - application_id + - '/roles/' + - role_id + - '/permissions/' + - permissions_id_1, + config.host + '/v1/applications/' + application_id + '/roles/' + role_id + '/permissions/' + permissions_id_1, method: 'POST', headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(assign_permission_1_to_role, function() { + request(assign_permission_1_to_role, function () { done(); }); }); // ASSIGN PERMISSION 2 TO ROLE // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const assign_permission_2_to_role = { url: - config.host + - '/v1/applications/' + - application_id + - '/roles/' + - role_id + - '/permissions/' + - permissions_id_2, + config.host + '/v1/applications/' + application_id + '/roles/' + role_id + '/permissions/' + permissions_id_2, method: 'POST', headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(assign_permission_2_to_role, function() { + request(assign_permission_2_to_role, function () { done(); }); }); // ASSIGN ROLE TO USER // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const assign_role_to_user = { url: config.host + @@ -186,43 +170,35 @@ describe('API - 12 - fiware service permission request: ', function() { method: 'POST', headers: { 'Content-Type': 'application/json', - 'X-Auth-token': token, - }, + 'X-Auth-token': token + } }; - request(assign_role_to_user, function() { + request(assign_role_to_user, function () { done(); }); }); // GET OAUTH2 Token // eslint-disable-next-line no-undef - before(function(done) { + before(function (done) { const get_oauth_token = { url: config.host + '/oauth2/token', method: 'POST', headers: { - Authorization: - 'Basic ' + - Buffer.from(application_id + ':' + application_secret).toString( - 'base64' - ), - 'Content-Type': 'application/x-www-form-urlencoded', + Authorization: 'Basic ' + Buffer.from(application_id + ':' + application_secret).toString('base64'), + 'Content-Type': 'application/x-www-form-urlencoded' }, - body: - 'grant_type=password&username=' + - login.name + - '&password=' + - login.password, + body: 'grant_type=password&username=' + login.name + '&password=' + login.password }; - request(get_oauth_token, function(error, response, body) { + request(get_oauth_token, function (error, response, body) { const json = JSON.parse(body); oauth_access_token = json.access_token; done(); }); }); - describe('1) When requesting a resource only with resource and action that is permitted', function() { - it('should return a 200 OK and a Permit', function(done) { + describe('1) When requesting a resource only with resource and action that is permitted', function () { + it('should return a 200 OK and a Permit', function (done) { const list_permissions = { url: config.host + @@ -230,9 +206,9 @@ describe('API - 12 - fiware service permission request: ', function() { oauth_access_token + '&action=GET&resource=/v2/entities&app_id=' + application_id, - method: 'GET', + method: 'GET' }; - request(list_permissions, function(error, response, body) { + request(list_permissions, function (error, response, body) { should.not.exist(error); const json = JSON.parse(body); should.equal(json.authorization_decision, 'Permit'); @@ -241,18 +217,18 @@ describe('API - 12 - fiware service permission request: ', function() { }); }); }); - describe('2) When requesting a resource with resource, action and fiware_service that is permitted', function() { - it('should return a 200 OK and a Permit', function(done) { + describe('2) When requesting a resource with resource, action and authorization_service_header that is permitted', function () { + it('should return a 200 OK and a Permit', function (done) { const list_permissions = { url: config.host + '/user?access_token=' + oauth_access_token + - '&action=POST&resource=/login&fiware_service=test&app_id=' + + '&action=POST&resource=/login&authorization_service_header=test&app_id=' + application_id, - method: 'GET', + method: 'GET' }; - request(list_permissions, function(error, response, body) { + request(list_permissions, function (error, response, body) { should.not.exist(error); const json = JSON.parse(body); should.equal(json.authorization_decision, 'Permit'); @@ -261,18 +237,18 @@ describe('API - 12 - fiware service permission request: ', function() { }); }); }); - describe('3) When requesting a resource with resource, action and wrong fiware_service that is not permitted', function() { - it('should return a 200 OK and a Deny', function(done) { + describe('3) When requesting a resource with resource, action and wrong authorization_service_header that is not permitted', function () { + it('should return a 200 OK and a Deny', function (done) { const list_permissions = { url: config.host + '/user?access_token=' + oauth_access_token + - '&action=GET&resource=login&fiware_service=wrong&app_id=' + + '&action=GET&resource=login&authorization_service_header=wrong&app_id=' + application_id, - method: 'GET', + method: 'GET' }; - request(list_permissions, function(error, response, body) { + request(list_permissions, function (error, response, body) { should.not.exist(error); const json = JSON.parse(body); should.equal(json.authorization_decision, 'Deny'); @@ -281,18 +257,18 @@ describe('API - 12 - fiware service permission request: ', function() { }); }); }); - describe('4) When requesting a resource with fiware_service, action and wrong resource that is not permitted', function() { - it('should return a 200 OK and a Deny', function(done) { + describe('4) When requesting a resource with authorization_service_header, action and wrong resource that is not permitted', function () { + it('should return a 200 OK and a Deny', function (done) { const list_permissions = { url: config.host + '/user?access_token=' + oauth_access_token + - '&action=GET&resource=wrong&fiware_service=test&app_id=' + + '&action=GET&resource=wrong&authorization_service_header=test&app_id=' + application_id, - method: 'GET', + method: 'GET' }; - request(list_permissions, function(error, response, body) { + request(list_permissions, function (error, response, body) { should.not.exist(error); const json = JSON.parse(body); should.equal(json.authorization_decision, 'Deny'); diff --git a/test/mysql-data/backup.sql b/test/mysql-data/backup.sql index f0173e24..d925d8c3 100755 --- a/test/mysql-data/backup.sql +++ b/test/mysql-data/backup.sql @@ -446,8 +446,8 @@ CREATE TABLE `permission` ( `xml` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `oauth_client_id` char(36) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, `is_regex` tinyint(1) NOT NULL DEFAULT '0', - `fiware_service` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `use_fiware_service` tinyint(1) NOT NULL DEFAULT '0', + `authorization_service_header` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `use_authorization_service_header` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `oauth_client_id` (`oauth_client_id`), CONSTRAINT `permission_ibfk_1` FOREIGN KEY (`oauth_client_id`) REFERENCES `oauth_client` (`id`) ON DELETE CASCADE @@ -695,7 +695,7 @@ CREATE TABLE `user_authorized_application` ( LOCK TABLES `user_authorized_application` WRITE; /*!40000 ALTER TABLE `user_authorized_application` DISABLE KEYS */; -INSERT INTO `user_authorized_application` VALUES +INSERT INTO `user_authorized_application` VALUES (1,'admin','8ca60ce9-32f9-42d6-a013-a19b3af0c13d', NULL, NULL), (2,'aaaaaaaa-good-0000-0000-000000000000','tutorial-dckr-site-0000-xpresswebapp', 'username,email', NULL); /*!40000 ALTER TABLE `user_authorized_application` ENABLE KEYS */; diff --git a/test/templates/api/009-permissions.json b/test/templates/api/009-permissions.json index a3c4a8d1..623149b0 100755 --- a/test/templates/api/009-permissions.json +++ b/test/templates/api/009-permissions.json @@ -23,8 +23,8 @@ "description": "permission 1 description", "action": "GET", "resource": "login", - "fiware_service": "test", - "use_fiware_service": true + "authorization_service_header": "test", + "use_authorization_service_header": true } }, "invalid_perm_body": { @@ -36,47 +36,47 @@ "xml": "" } }, - "invalid_perm_body_no_fiware_service_but_use_fiware_service": { + "invalid_perm_body_no_authorization_service_header_but_use_authorization_service_header": { "permission": { "name": "permission 3", "description": "permission 3 description", "action": "GET", "resource": "login", - "use_fiware_service": true + "use_authorization_service_header": true } }, - "invalid_perm_body_no_use_fiware_service_but_fiware_service": { + "invalid_perm_body_no_use_authorization_service_header_but_authorization_service_header": { "permission": { "name": "permission 4", "description": "permission 4 description", "action": "GET", "resource": "login", - "fiware_service": "test" + "authorization_service_header": "test" } }, - "invalid_perm_body_fiware_service_and_xml": { + "invalid_perm_body_authorization_service_header_and_xml": { "permission": { "name": "permission 5", "description": "permission 5 description", "xml": "", - "fiware_service": "test" + "authorization_service_header": "test" } }, - "invalid_perm_body_use_fiware_service_and_xml": { + "invalid_perm_body_use_authorization_service_header_and_xml": { "permission": { "name": "permission 6", "description": "permission 6 description", "xml": "", - "use_fiware_service": true + "use_authorization_service_header": true } }, - "valid_perm_body_no_fiware_service_but_use_fiware_service_is_false": { + "valid_perm_body_no_authorization_service_header_but_use_authorization_service_header_is_false": { "permission": { "name": "permission 7", "description": "permission 7 description", "action": "GET", "resource": "login", - "use_fiware_service": false + "use_authorization_service_header": false } } }, @@ -97,8 +97,8 @@ "description": "Test permission 3 description", "action": "GET", "resource": "login", - "fiware_service": "test", - "use_fiware_service": true + "authorization_service_header": "test", + "use_authorization_service_header": true } }, "new_values": { @@ -107,7 +107,7 @@ "description": "new description of permission 3", "action": "POST", "resource": "resource", - "use_fiware_service": false + "use_authorization_service_header": false } } }, diff --git a/test/templates/api/012-resource_request.json b/test/templates/api/012-resource_request.json index 0be5e643..c16eab10 100644 --- a/test/templates/api/012-resource_request.json +++ b/test/templates/api/012-resource_request.json @@ -23,8 +23,8 @@ "description": "permission 1 description", "action": "POST", "resource": "/login", - "fiware_service": "test", - "use_fiware_service": true + "authorization_service_header": "test", + "use_authorization_service_header": true } }, "valid_perm_body2": { diff --git a/views/applications/_create_permission.ejs b/views/applications/_create_permission.ejs index 1a8d5c91..96c3a714 100755 --- a/views/applications/_create_permission.ejs +++ b/views/applications/_create_permission.ejs @@ -60,14 +60,14 @@
- +
- +
- - + +
@@ -92,6 +92,7 @@ <% } -%> +