From edf0e031dc6553e2b46cd42fb17512bd30a646dc Mon Sep 17 00:00:00 2001 From: Minu Mathew Date: Fri, 15 Jul 2022 16:23:37 -0500 Subject: [PATCH 01/15] Master to develop after 1.15.0 (#967) * Update CHANGELOG.md * Update version numbers in the OpenAPI documents. * Update CHANGELOG.md * Update CHANGELOG.md * Update version number in YAML file. * Point to production health and talent chooser API documentation in production. * Update CHANGELOG. * Update version number in OpenAPI spec files. * Update Building Block URL in Api Doc Dockerfile. * Minor update to CHANGELOG. * Fix Auth library dependencies versions to avoid breaking changes. * Update Events Building Block Dockerfile. * Update App Config Dockerfile. * Update Authentication Building Block Dockerfile. * Update Profile Building Block Dockerfile. * Update Contributions Building Block Dockerfile and requirements. * Update Contributions Catalog Dockerfile and requirements. * Update Logging Building Block Dockerfile. * Update version numbers in API specs. * Update CHANGELOG. * Update CHANGELOG.md * Update version number. * Update CHANGELOG.md * Update CHANGELOG.md * Update version numbers in OpenAPI specification. * turn off group authentication on image get endpoint * turn off group authentication on image get endpoint * Update Events Building Block logs and related configuration. * Update CHANGELOG. * Added more information to logs * changed the log's building block name * updated to use longDescription * updated changelog * Update CHANGELOG and verson numbers. * Update API Doc Dockerfile. * Fix CHANGELOG. * Fix CHANGELOG. * Update version numbers in SECURITY.md * Fix merge conflicts. * Update CHANGELOG.md * Update CHANGELOG. * Update Dockerfile. * Update version number in API spec files. * Updater version in SECURITY.md * Update CHANGELOG. * Update Events BB version number. * Update SECURITY.md * updated for release * resolved merge conflicts * updated version in yaml files * updated version in yaml * workaround for Oauth transport lib error * updated changelog * updated docker build with nocache option * moved ProxyFix to catalog * removed no-cache from docker build * updated version in yaml * updated security * Update contributions/api/contributions_rest_service.py remove blank line Co-authored-by: Sandeep Puthanveetil Satheesan * added version comparison * Update catalog_rest_service.py Comment on the proxyFix Co-authored-by: Sandeep Puthanveetil Satheesan * updated release version * updated dev urls Co-authored-by: Sandeep Puthanveetil Satheesan Co-authored-by: Bing Zhang Co-authored-by: YONG WOOK KIM --- CHANGELOG.md | 5 ++++- SECURITY.md | 7 ++++--- appconfigservice/appconfig.yaml | 2 +- authservice/auth.yaml | 2 +- contributions/contribution.yaml | 2 +- eventservice/events.yaml | 2 +- loggingservice/logging.yaml | 2 +- profileservice/profile.yaml | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7b95317..2b78ed89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [1.15.0] - 2022-07-11 ### Added - Support in Contributions BB to upload an icon for Talents and Capabilities. [#945](https://github.com/rokwire/rokwire-building-blocks-api/issues/945) - Added error message when the Contributions are not retrieved from the Contributions BB [#923](https://github.com/rokwire/rokwire-building-blocks-api/issues/923) @@ -499,7 +501,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - References to AWS keys and variables in the Events Building Block. -[Unreleased]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.14.1...HEAD +[Unreleased]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.15.1...HEAD +[1.15.0]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.14.1...1.15.0 [1.14.1]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.14.0...1.14.1 [1.14.0]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.13.0...1.14.0 [1.13.0]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.12.1...1.13.0 diff --git a/SECURITY.md b/SECURITY.md index c9d158c5..02eb1d21 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,8 +4,9 @@ Patches for **Rokwire Building Blocks** in this repository will only be applied to the following versions: -| Version | Supported | -| ------- | ------------------ | +| Version | Supported | +|----------| ------------------ | +| 1.15.0 | :white_check_mark: | | 1.14.1 | :white_check_mark: | | 1.14.0 | :white_check_mark: | | 1.13.0 | :white_check_mark: | @@ -16,7 +17,7 @@ Patches for **Rokwire Building Blocks** in this repository will only be applied | 1.11.1 | :white_check_mark: | | 1.11.0 | :white_check_mark: | | 1.10.0 | :white_check_mark: | -| < 1.10.0 | :x: | +| < 1.10.0 | :x: | ## Reporting a Vulnerability diff --git a/appconfigservice/appconfig.yaml b/appconfigservice/appconfig.yaml index a12a8d80..6957ed2a 100755 --- a/appconfigservice/appconfig.yaml +++ b/appconfigservice/appconfig.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire App Config Building Block API description: App Config Building Block API Documentation - version: 1.14.1 + version: 1.15.0 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/authservice/auth.yaml b/authservice/auth.yaml index 5df23e53..4ffa2f42 100644 --- a/authservice/auth.yaml +++ b/authservice/auth.yaml @@ -2,7 +2,7 @@ openapi: 3.0.2 info: title: Rokwire Auth Building Block API description: Authentication Building Block API Documentation - version: 1.14.1 + version: 1.15.0 paths: /authentication/phone-initiate: post: diff --git a/contributions/contribution.yaml b/contributions/contribution.yaml index ab388065..f874d009 100644 --- a/contributions/contribution.yaml +++ b/contributions/contribution.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire Contributions Building Block API description: Contributions Building Block API Documentation - version: 1.14.1 + version: 1.15.0 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/eventservice/events.yaml b/eventservice/events.yaml index 9ff12c51..075b12d9 100755 --- a/eventservice/events.yaml +++ b/eventservice/events.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire Events Building Block API description: Events Building Block API Documentation - version: 1.14.1 + version: 1.15.0 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/loggingservice/logging.yaml b/loggingservice/logging.yaml index 7084cc26..7c956c67 100755 --- a/loggingservice/logging.yaml +++ b/loggingservice/logging.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire Logging Building Block API description: Logging Building Block API Documentation - version: 1.14.1 + version: 1.15.0 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/profileservice/profile.yaml b/profileservice/profile.yaml index 27c96de0..10869ec3 100755 --- a/profileservice/profile.yaml +++ b/profileservice/profile.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire Profile Building Block API description: Profile Building Block API Documentation - version: 1.14.1 + version: 1.15.0 servers: - url: https://api.rokwire.illinois.edu description: Production server From a9922920135dff1a6134e9304f6c69609f243d0c Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Fri, 15 Jul 2022 16:35:03 -0500 Subject: [PATCH 02/15] Update CODEOWNERS (#969) --- CODEOWNERS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index e65141f5..98b8ea8e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -5,7 +5,7 @@ /appconfigservice/ @minump # Authentication Middleware Library -/lib/auth-middleware/ @ywkim312 +/lib/auth-middleware/ @sandeep-ps # API Doc /Dockerfile @sandeep-ps @@ -15,14 +15,14 @@ /eventservice/ @bingzhang # Logging Building Block -/loggingservice/ @ywkim312 +/loggingservice/ @sandeep-ps # Profile Building Block -/profileservice/ @ywkim312 +/profileservice/ @sandeep-ps # Contributions Building Block -/contributions/* @ywkim312 -/contributions/api/ @ywkim312 +/contributions/* @minump +/contributions/api/ @minump # Contributions Catalog /contributions/catalog/ @minump From 69e4851fc5c14d2dce7058195762bffa4871bbb5 Mon Sep 17 00:00:00 2001 From: Minu Mathew Date: Tue, 26 Jul 2022 13:03:08 -0500 Subject: [PATCH 03/15] 951 delete capabilitytalent within contribution (#956) * updates * updated delete contirbution * deletion endpoint and html * updated changelog * added popup modal * Update popup with a text change Co-authored-by: Sandeep Puthanveetil Satheesan * removed padding from modalcontent * changed order * added delete capability button * added delete button to clean cap * added div for entire capability * update delete function * updated formatting blocks: * updated condition to check for capability * updated indexes for when capability deleted * added talent delete * updated changelog * updated indexing in talents * updated extracting id from jQ obj * updated changelog * removed extra space Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 2 + .../catalog/models/capability_utilities.py | 42 +- .../catalog/models/talent_utilities.py | 43 +- .../templates/contribute/contribute.html | 1780 +++++++++-------- 4 files changed, 958 insertions(+), 909 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b78ed89..44b75750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Ability to delete a capability or talent from contribution. [#951](https://github.com/rokwire/rokwire-building-blocks-api/issues/951) ## [1.15.0] - 2022-07-11 ### Added diff --git a/contributions/catalog/models/capability_utilities.py b/contributions/catalog/models/capability_utilities.py index 3cfcce20..4abd6030 100644 --- a/contributions/catalog/models/capability_utilities.py +++ b/contributions/catalog/models/capability_utilities.py @@ -48,25 +48,27 @@ def to_capability(d): capability_list = [] # check how many capabilities are in the given json - # this should be checked keys that is as surfix of _number + # this should be checked keys that is as suffix of _number num_cap = 0 - # if there is capability_name_0, it means that there is capability - if "capability_name_0" in d: - keys = list(d.keys()) - cap_len = [] + # if there is capability_name_{num}, it means that there is capability + capability_pattern = re.compile('capability_name_[0-9]') + keys = list(d.keys()) + if any(capability_pattern.match(key) for key in keys): + cap_indexes = [] # iterate to count the number of capabilities for key in keys: key_splitted = key.split("capability_name_") if len(key_splitted) > 1: - cap_len.append(int(key_splitted[1])) - num_cap = max(cap_len) + 1 + cap_indexes.append(int(key_splitted[1])) + num_cap = len(cap_indexes) # init capability for _ in range(num_cap): capability_list.append(init_capability()) - for i, capability in enumerate(capability_list): + for ind, capability in enumerate(capability_list): cap_id = str(uuid.uuid4()) capability['id'] = cap_id + i = cap_indexes[ind] # get environment key value pairs by pattern matching. # filter by matching with pattern environmentVariables_key_{{env_num}}_{{cap_num}} key_pattern = re.compile('environmentVariables_key_[0-9]+' + '_' + str(i)) @@ -80,29 +82,29 @@ def to_capability(d): for k, v in d.items(): if "isOpenSource_" + str(i) in k: if v[0] == 'y': - capability_list[i]["isOpenSource"] = True + capability_list[ind]["isOpenSource"] = True else: - capability_list[i]["isOpenSource"] = False - d[k][0] = capability_list[i]["isOpenSource"] + capability_list[ind]["isOpenSource"] = False + d[k][0] = capability_list[ind]["isOpenSource"] elif "sourceRepoUrl_" + str(i) in k: - if capability_list[i]["isOpenSource"]: - capability_list[i]["sourceRepoUrl"] = v[0] + if capability_list[ind]["isOpenSource"]: + capability_list[ind]["sourceRepoUrl"] = v[0] elif "deploymentDetails_" in k: if ("_" + str(i)) in k: name = (k.split("deploymentDetails_")[-1]).split('_' + str(i))[0] - capability_list[i]["deploymentDetails"][name] = v[0] + capability_list[ind]["deploymentDetails"][name] = v[0] elif "dataDeletionEndpointDetails_" in k: if ("_" + str(i)) in k: name = (k.split("dataDeletionEndpointDetails_")[-1]).split('_' + str(i))[0] - capability_list[i]["dataDeletionEndpointDetails"][name] = v[0] + capability_list[ind]["dataDeletionEndpointDetails"][name] = v[0] elif "capability_" in k: if ("_" + str(i)) in k: name = (k.split("capability_")[-1]).split('_' + str(i))[0] - if name in capability_list[i] and isinstance(capability_list[i][name], list) and len(v[0]) > 0: - capability_list[i][name].append(v[0]) - elif name in capability_list[i] and isinstance(capability_list[i][name], list) and len(v[0]) == 0: - capability_list[i][name] = [] + if name in capability_list[ind] and isinstance(capability_list[ind][name], list) and len(v[0]) > 0: + capability_list[ind][name].append(v[0]) + elif name in capability_list[ind] and isinstance(capability_list[ind][name], list) and len(v[0]) == 0: + capability_list[ind][name] = [] else: - capability_list[i][name] = v[0] + capability_list[ind][name] = v[0] return capability_list diff --git a/contributions/catalog/models/talent_utilities.py b/contributions/catalog/models/talent_utilities.py index 38bfafc2..ec7d7f0d 100644 --- a/contributions/catalog/models/talent_utilities.py +++ b/contributions/catalog/models/talent_utilities.py @@ -15,6 +15,7 @@ from datetime import date import uuid import json +import re def init_talent(): d = { @@ -39,28 +40,28 @@ def to_talent(d): talent_list = [] # check how many capabilities are in the given json - # this should be checked keys that is as surfix of _number + # this should be checked keys that is as suffix of _number num_tal = 0 - - # if there is talent_name_0, this means that there is talent - if 'talent_name_0' in d.keys(): - keys = list(d.keys()) - tal_len = [] - # iterated talents to see how many talents are in there + # if there is capability_name_{num}, it means that there is capability + talent_pattern = re.compile('talent_name_[0-9]') + keys = list(d.keys()) + if any(talent_pattern.match(key) for key in keys): + tal_indexes = [] + # iterate to count the number of capabilities for key in keys: key_splitted = key.split("talent_name_") if len(key_splitted) > 1: - tal_len.append(int(key_splitted[1])) - num_tal = max(tal_len) + 1 + tal_indexes.append(int(key_splitted[1])) + num_tal = len(tal_indexes) - # init talent + # init capability for _ in range(num_tal): talent_list.append(init_talent()) - for i, talent in enumerate(talent_list): + for ind, talent in enumerate(talent_list): tal_id = str(uuid.uuid4()) talent['id'] = tal_id - + i = tal_indexes[ind] for k, v in d.items(): if "minUserPrivacyLevel_" in k: if len(str(v[0])) > 0: @@ -74,25 +75,25 @@ def to_talent(d): # the items are only single item entry. # However, required capabilities should be a list so it should be handled differently, # and if there is any item that is a list, that should be handled separately. - if name in talent_list[i] and isinstance(talent_list[i][name], list) and len(v[0]) > 0: + if name in talent_list[ind] and isinstance(talent_list[ind][name], list) and len(v[0]) > 0: if name == "requiredCapabilities": for j in range(len(v)): v[j] = reconstruct_required_capabilities(v[j]) - talent_list[i][name].append(v[j]) + talent_list[ind][name].append(v[j]) elif name == "requiredBuildingBlocks": for j in range(len(v)): - talent_list[i][name].append(v[j]) + talent_list[ind][name].append(v[j]) elif name == "minEndUserRoles": for j in range(len(v)): - talent_list[i][name].append(v[j]) + talent_list[ind][name].append(v[j]) else: - talent_list[i][name].append(v[i]) - elif name in talent_list[i] and isinstance(talent_list[i][name], list) and len(v[0]) == 0: - talent_list[i][name] = [] + talent_list[ind][name].append(v[i]) + elif name in talent_list[ind] and isinstance(talent_list[ind][name], list) and len(v[0]) == 0: + talent_list[ind][name] = [] else: - talent_list[i][name] = v[0] + talent_list[ind][name] = v[0] - talent_list[i]["selfCertification"] = to_self_certification(d, i) + talent_list[ind]["selfCertification"] = to_self_certification(d, i) return talent_list diff --git a/contributions/catalog/webapps/templates/contribute/contribute.html b/contributions/catalog/webapps/templates/contribute/contribute.html index ab6da2ec..ef42fb79 100644 --- a/contributions/catalog/webapps/templates/contribute/contribute.html +++ b/contributions/catalog/webapps/templates/contribute/contribute.html @@ -502,151 +502,155 @@

Add a Person to this Contribution