From 86a5ad3424810c81d64fbab7093dac37c2859ac5 Mon Sep 17 00:00:00 2001 From: Minu Mathew Date: Tue, 31 May 2022 09:02:14 -0500 Subject: [PATCH 01/13] Master to develop after 1.14.1 (#938) * 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 * Update Dockerfile to include DEV instance url Co-authored-by: Sandeep Puthanveetil Satheesan Co-authored-by: Sandeep Puthanveetil Satheesan Co-authored-by: Bing Zhang Co-authored-by: YONG WOOK KIM --- CHANGELOG.md | 7 ++++++- SECURITY.md | 1 + appconfigservice/appconfig.yaml | 2 +- authservice/auth.yaml | 2 +- contributions/catalog/catalog_rest_service.py | 4 ++++ contributions/contribution.yaml | 2 +- eventservice/events.yaml | 2 +- loggingservice/logging.yaml | 2 +- profileservice/profile.yaml | 2 +- 9 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fbe2ef8..072e3508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.14.1] - 2022-05-26 +### Fixed +- ProxyFix for OAuth Lib Transport Error when deploying in docker containers. [#928](https://github.com/rokwire/rokwire-building-blocks-api/issues/928) + ## [1.14.0] - 2022-05-17 ### Added - Sending email to reviewers. [#839](https://github.com/rokwire/rokwire-building-blocks-api/issues/839) @@ -477,7 +481,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.0...HEAD +[Unreleased]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.14.1...HEAD +[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 [1.12.1]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.12.0...1.12.1 diff --git a/SECURITY.md b/SECURITY.md index cbde9cca..7ed077bd 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,6 +6,7 @@ Patches for **Rokwire Building Blocks** in this repository will only be applied | Version | Supported | | ------- | ------------------ | +| 1.14.1 | :white_check_mark: | | 1.14.0 | :white_check_mark: | | 1.13.0 | :white_check_mark: | | 1.12.1 | :white_check_mark: | diff --git a/appconfigservice/appconfig.yaml b/appconfigservice/appconfig.yaml index 91b7c461..a12a8d80 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.0 + version: 1.14.1 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/authservice/auth.yaml b/authservice/auth.yaml index 916a903c..5df23e53 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.0 + version: 1.14.1 paths: /authentication/phone-initiate: post: diff --git a/contributions/catalog/catalog_rest_service.py b/contributions/catalog/catalog_rest_service.py index 1cebce24..37fd68a9 100644 --- a/contributions/catalog/catalog_rest_service.py +++ b/contributions/catalog/catalog_rest_service.py @@ -25,6 +25,7 @@ from controllers.config import Config as cfg from controllers.contribute import bp as contribute_bp from db import init_app +from werkzeug.middleware.proxy_fix import ProxyFix debug = cfg.DEBUG @@ -50,6 +51,9 @@ template_folder=template_dir) app.config.from_object(cfg) +# TODO: Experimental fix for running behind the load balancer. Revisit to verify that this fix matches the actual deployment environment. Ref: https://werkzeug.palletsprojects.com/en/2.1.x/middleware/proxy_fix/ +app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_host=1) + init_app(app) app.register_blueprint(contribute_bp) diff --git a/contributions/contribution.yaml b/contributions/contribution.yaml index b00dc860..d04cd77c 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.0 + version: 1.14.1 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/eventservice/events.yaml b/eventservice/events.yaml index 6dcab60c..ffb30473 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.0 + version: 1.14.1 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/loggingservice/logging.yaml b/loggingservice/logging.yaml index df16940d..7084cc26 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.0 + version: 1.14.1 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/profileservice/profile.yaml b/profileservice/profile.yaml index 6e44d091..27c96de0 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.0 + version: 1.14.1 servers: - url: https://api.rokwire.illinois.edu description: Production server From ad0643698b2aa47999b96f935d7cce0838e79751 Mon Sep 17 00:00:00 2001 From: Minu Mathew Date: Thu, 2 Jun 2022 13:47:01 -0500 Subject: [PATCH 02/13] 906 catalog talent date validation (#924) * validate start end dates * updated changelg * updated changelog and resolved merge conflict with develop Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 2 ++ .../templates/contribute/contribute.html | 26 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 072e3508..f93b6dcc 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 +- Validate start and end dates. [#906](https://github.com/rokwire/rokwire-building-blocks-api/issues/906) ## [1.14.1] - 2022-05-26 ### Fixed diff --git a/contributions/catalog/webapps/templates/contribute/contribute.html b/contributions/catalog/webapps/templates/contribute/contribute.html index 3eaa3310..5608aa30 100644 --- a/contributions/catalog/webapps/templates/contribute/contribute.html +++ b/contributions/catalog/webapps/templates/contribute/contribute.html @@ -1406,13 +1406,24 @@

Add a Talent to this Contribution

id="start_day_{{loop.index0}}" name="talent_startDate_{{loop.index0}}" type="date" - value="{{ talent|filter_nested_dict(["startDate"]) }}"> + value="{{ talent|filter_nested_dict(["startDate"]) }}"> +
@@ -1645,6 +1656,19 @@

Contact Details

}); }); + // validate start and end dates in talent form + $('[id^="start_day"]').change(function() { + let start_day_id = this.id; + let id_number = start_day_id.replace("start_day_", ""); + let start_val = $(this).val(); + let end_day = document.getElementById("end_day_" + id_number); + end_day.setAttribute("min", start_val); + let end_val = end_day.val; + if (end_val < start_val) { + end_day.val(null) + } + }); + $(function () { function split(val) { return val.split(/,\s*/); From 56d17209f9d41d409f220aa0b5d850d6a78cd3b5 Mon Sep 17 00:00:00 2001 From: Minu Mathew Date: Thu, 2 Jun 2022 14:09:37 -0500 Subject: [PATCH 03/13] Check if reviewers collection is empty (#936) * added if condition to check for empty list * added comment * updated changelog * updated list reviewers check * updated list reviewers check None --- CHANGELOG.md | 5 +++++ contributions/api/controllers/contributions.py | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f93b6dcc..87eb95a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added + +### Changed + +### Fixed - Validate start and end dates. [#906](https://github.com/rokwire/rokwire-building-blocks-api/issues/906) +- Bug if reviewers collection is empty. [#929](https://github.com/rokwire/rokwire-building-blocks-api/issues/929) ## [1.14.1] - 2022-05-26 ### Fixed diff --git a/contributions/api/controllers/contributions.py b/contributions/api/controllers/contributions.py index 01fb05af..8c7b57a7 100644 --- a/contributions/api/controllers/contributions.py +++ b/contributions/api/controllers/contributions.py @@ -202,8 +202,10 @@ def post(token_info): # send new contribution email to add reviewers if notification_enabled: list_reviewers = mongoutils.list_reviewers() - for reviewer in list_reviewers: - send_email_new_contribution(reviewer['githubUsername'], contribution_name) + # check for empty collection + if list_reviewers: + for reviewer in list_reviewers: + send_email_new_contribution(reviewer['githubUsername'], contribution_name) return rs_handlers.return_id(msg, 'id', contribution_id) From ba6ff9daac77e8e584da5a115aab8a545efb5048 Mon Sep 17 00:00:00 2001 From: Minu Mathew Date: Thu, 2 Jun 2022 17:14:22 -0500 Subject: [PATCH 04/13] Display self certification in talent details page (#939) * added None to display if field is empty * updated changelog --- CHANGELOG.md | 1 + .../templates/contribute/talent_details.html | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87eb95a5..dc631e59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed +- Display of Talent Self Certification fields when empty. [#913](https://github.com/rokwire/rokwire-building-blocks-api/issues/913) ### Fixed - Validate start and end dates. [#906](https://github.com/rokwire/rokwire-building-blocks-api/issues/906) diff --git a/contributions/catalog/webapps/templates/contribute/talent_details.html b/contributions/catalog/webapps/templates/contribute/talent_details.html index 981c786d..4d67f537 100644 --- a/contributions/catalog/webapps/templates/contribute/talent_details.html +++ b/contributions/catalog/webapps/templates/contribute/talent_details.html @@ -158,30 +158,55 @@

Self Certification

Deleting data upon request   {{post.selfCertification.dataDeletionUponRequest}} + {% else %} + + Deleting data upon request   + None + {% endif %} {% if post.selfCertification.discloseAds %} Disclose ads   {{post.selfCertification.discloseAds}} + {% else %} + + Disclose ads   + None + {% endif %} {% if post.selfCertification.discloseImageRights %} Disclose right to use images   {{post.selfCertification.discloseImageRights}} + {% else %} + + Disclose right to use images   + None + {% endif %} {% if post.selfCertification.discloseSponsors %} Disclose sponsors   {{post.selfCertification.discloseSponsors}} + {% else %} + + Disclose sponsors   + None + {% endif %} {% if post.selfCertification.respectingUserPrivacySetting %} Respecting privacy setting   {{post.selfCertification.respectingUserPrivacySetting}} + {% else %} + + Respecting privacy setting   + None + {% endif %}

From d2faa6a7e153d48ef944c0e2a69be2350dcf353f Mon Sep 17 00:00:00 2001 From: YONG WOOK KIM Date: Mon, 20 Jun 2022 14:18:54 -0500 Subject: [PATCH 05/13] added error message when catalog has wrong api key (#925) * added error message when catalog has wrong api key * added error message in home page * changed caption * Update CHANGELOG. * Update CHANGELOG. Co-authored-by: Minu Mathew Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 1 + contributions/catalog/catalog_rest_service.py | 20 +++++++++++++++++-- contributions/catalog/utils/jsonutil.py | 7 +++++++ .../webapps/templates/contribute/home.html | 6 ++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc631e59..cfc50086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Added error message when the Contributions are not retrieved from the Contributions BB [#923](https://github.com/rokwire/rokwire-building-blocks-api/issues/923) ### Changed - Display of Talent Self Certification fields when empty. [#913](https://github.com/rokwire/rokwire-building-blocks-api/issues/913) diff --git a/contributions/catalog/catalog_rest_service.py b/contributions/catalog/catalog_rest_service.py index 37fd68a9..1b0a143c 100644 --- a/contributions/catalog/catalog_rest_service.py +++ b/contributions/catalog/catalog_rest_service.py @@ -13,6 +13,7 @@ # limitations under the License. import logging +import json import os import utils.requestutil as requestutil import utils.jsonutil as jsonutil @@ -116,8 +117,18 @@ def index(): tal_json = jsonutil.create_talent_json_from_contribution_json(result.json()) else: # query only published ones + show_err_message = False headers = requestutil.get_header_using_api_key() result = requestutil.request_contributions(headers) + + if result.status_code != 200: + msg = { + "ERROR": "There is a problem getting contributions list. Maybe API Key is not correct." + } + msg_json = jsonutil.create_log_json("Contribution", "SEARCH", msg) + logging.info("Contribution SEARCH " + json.dumps(msg_json)) + show_err_message = True + if show_sel == "capability": # create the json for only capability cap_json = jsonutil.create_capability_json_from_contribution_json(result.json()) @@ -129,8 +140,13 @@ def index(): cap_json = jsonutil.create_capability_json_from_contribution_json(result.json()) tal_json = jsonutil.create_talent_json_from_contribution_json(result.json()) - return render_template('contribute/home.html', git_tag=git_tag, git_sha=git_sha, - cap_json=cap_json, tal_json=tal_json, show_sel=show_sel, user=user) + # show connection error message to main page + if show_err_message: + err_msg = "ERROR: There is a problem getting contributions list. Please try again later." + return render_template('contribute/error.html', error_msg=err_msg) + else: + return render_template('contribute/home.html', git_tag=git_tag, git_sha=git_sha, + cap_json=cap_json, tal_json=tal_json, show_sel=show_sel, user=user) @app.route("/login") def login(): diff --git a/contributions/catalog/utils/jsonutil.py b/contributions/catalog/utils/jsonutil.py index 703686aa..7ad4af84 100644 --- a/contributions/catalog/utils/jsonutil.py +++ b/contributions/catalog/utils/jsonutil.py @@ -125,3 +125,10 @@ def create_talent_json_from_contribution_json(injson): logging.warning("There is no talent in the contribution") return out_json_list + +def create_log_json(ep_name, ep_method, in_json): + in_json['ep_building_block'] = "contributions_building_block" + in_json['ep_name'] = ep_name + in_json['ep_method'] = ep_method + + return in_json \ No newline at end of file diff --git a/contributions/catalog/webapps/templates/contribute/home.html b/contributions/catalog/webapps/templates/contribute/home.html index 75fe1a82..3505b190 100644 --- a/contributions/catalog/webapps/templates/contribute/home.html +++ b/contributions/catalog/webapps/templates/contribute/home.html @@ -249,6 +249,12 @@

{{ talent|filter_nested_dict(["name"]) }}

{% endfor %} {% endif %} + + {% if (tal_json|length == 0) and (cap_json|length == 0) %} +
+

There are no published contributions.

+
+ {% endif %} {% include 'topnav_javascript.html' %} From 07d4a695725081b21bc1cadcf1defc4cb574dff9 Mon Sep 17 00:00:00 2001 From: Minu Mathew Date: Mon, 20 Jun 2022 14:26:46 -0500 Subject: [PATCH 06/13] 921 env var catalog (#943) * updated indexing of env vars * updated tocapability in datasetutils * corrected indexing and list manipulation * added semicolon in scrpt var * updated index for add more fields button * updated changelog * updated indexing with children method * added comments for readability --- CHANGELOG.md | 1 + .../catalog/controllers/contribute.py | 1 - .../catalog/models/capability_utilities.py | 15 ++-- .../templates/contribute/contribute.html | 77 ++++++++++++------- 4 files changed, 60 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfc50086..14653e0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Validate start and end dates. [#906](https://github.com/rokwire/rokwire-building-blocks-api/issues/906) - Bug if reviewers collection is empty. [#929](https://github.com/rokwire/rokwire-building-blocks-api/issues/929) +- Fixed indexing of environment variables key and value pairs. [#921](https://github.com/rokwire/rokwire-building-blocks-api/issues/921) ## [1.14.1] - 2022-05-26 ### Fixed diff --git a/contributions/catalog/controllers/contribute.py b/contributions/catalog/controllers/contribute.py index afa2df99..3293777c 100644 --- a/contributions/catalog/controllers/contribute.py +++ b/contributions/catalog/controllers/contribute.py @@ -580,7 +580,6 @@ def put_contribution(json_data, contribution_id): try: # set PUT url put_url = cfg.CONTRIBUTION_BUILDING_BLOCK_URL + "/" + contribution_id - # Setting up post request result = requests.put(put_url, headers=headers, diff --git a/contributions/catalog/models/capability_utilities.py b/contributions/catalog/models/capability_utilities.py index d5232738..3cfcce20 100644 --- a/contributions/catalog/models/capability_utilities.py +++ b/contributions/catalog/models/capability_utilities.py @@ -13,6 +13,7 @@ # limitations under the License. import uuid +import re def init_capability(): d = {'id': '', @@ -63,14 +64,18 @@ def to_capability(d): # init capability for _ in range(num_cap): capability_list.append(init_capability()) - for i, capability in enumerate(capability_list): cap_id = str(uuid.uuid4()) capability['id'] = cap_id - - env_k, env_v = d['environmentVariables_key_' + str(i)], d['environmentVariables_value_' + str(i)] - for k, v in list(zip(env_k, env_v)): - capability["deploymentDetails"]['environmentVariables'].append({'key': k, 'value': v}) + # 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)) + val_pattern = re.compile('environmentVariables_value_[0-9]+' + '_' + str(i)) + d_keys = list(filter(key_pattern.match, d)) # filter keys matching pattern + d_vals = list(filter(val_pattern.match, d)) # filter keys matching pattern + for k, v in zip(d_keys, d_vals): + # get and append the values + capability["deploymentDetails"]['environmentVariables'].append({'key': d[k][0], 'value': d[v][0]}) for k, v in d.items(): if "isOpenSource_" + str(i) in k: diff --git a/contributions/catalog/webapps/templates/contribute/contribute.html b/contributions/catalog/webapps/templates/contribute/contribute.html index 5608aa30..8eb761c4 100644 --- a/contributions/catalog/webapps/templates/contribute/contribute.html +++ b/contributions/catalog/webapps/templates/contribute/contribute.html @@ -500,6 +500,7 @@

Add a Person to this Contribution