Skip to content

Commit

Permalink
Merge pull request #963 from rokwire/release/1.15.0
Browse files Browse the repository at this point in the history
Release/1.15.0
  • Loading branch information
sandeep-ps authored Jul 11, 2022
2 parents 277c1be + 8d38391 commit 53cab3e
Show file tree
Hide file tree
Showing 35 changed files with 331 additions and 68 deletions.
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [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)
- Delete contribution button. [#944](https://github.com/rokwire/rokwire-building-blocks-api/issues/944)
- Add support for hybrid events in Events BB. [#955](https://github.com/rokwire/rokwire-building-blocks-api/issues/955)

### Changed
- Display of Talent Self Certification fields when empty. [#913](https://github.com/rokwire/rokwire-building-blocks-api/issues/913)
- ROKWIRE_GROUP_API_KEY changed to INTERNAL_API_KEY. [#940](https://github.com/rokwire/rokwire-building-blocks-api/issues/940)
- Updated SECURITY.md [#946](https://github.com/rokwire/rokwire-building-blocks-api/issues/946)

### 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)

### Security
- Update PyJWT package version and corresponding auth middleware library code. [#935](https://github.com/rokwire/rokwire-building-blocks-api/issues/935)

## [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)
Expand Down Expand Up @@ -481,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
Expand Down
9 changes: 5 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -16,9 +17,9 @@ 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

Vulnerabilities can be responsibly disclosed to [[email protected]](mailto:securitysupport@illinois.edu).
Vulnerabilities can be responsibly disclosed through the process documented at https://go.illinois.edu/vulnerability.
Bugs can be reported by creating a [GitHub issue](https://github.com/rokwire/rokwire-building-blocks-api/issues/new?assignees=&labels=bug&template=bug_report.md&title=%5BBUG%5D).
2 changes: 1 addition & 1 deletion appconfigservice/appconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion appconfigservice/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Jinja2==3.0.3
pymongo[tls,srv]==3.7.2
pytest==5.0.1
requests==2.22.0
pyjwt==1.7.1
pyjwt==2.4.0
cryptography==3.3.2
gunicorn==20.0.4
python-dotenv==0.10.3
Expand Down
1 change: 1 addition & 0 deletions auth-middleware-test-svc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ gunicorn==20.0.4
connexion[swagger-ui]==2.9.0
python-dotenv==0.10.3


../lib/auth-middleware
2 changes: 1 addition & 1 deletion authservice/auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion authservice/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Jinja2==3.0.3
schema==0.7.0
connexion[swagger-ui]==2.9.0
requests==2.22.0
pyjwt==1.7.1
pyjwt==2.4.0
cryptography==3.3.2
gunicorn==20.0.4
python-dateutil==2.8.0
python-dotenv==0.10.3
Expand Down
6 changes: 4 additions & 2 deletions contributions/api/controllers/contributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions contributions/api/models/capabilities/capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Capability():
def __init__(self, injson):
self.id = None
self.name = None
self.icon = None
self.description = None
self.isOpenSource = None
self.sourceRepoUrl = None
Expand All @@ -39,6 +40,12 @@ def set_id(self, id):
def get_id(self):
return self.id

def set_icon(self, icon):
self.icon = icon

def get_icon(self):
return self.icon

def set_name(self, name):
self.name = name

Expand Down
7 changes: 7 additions & 0 deletions contributions/api/models/talents/talent.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Talent():
def __init__(self, injson):
self.id = None
self.name = None
self.icon = None
self.shortDescription = None
self.longDescription = None
self.requiredCapabilities = None
Expand All @@ -37,6 +38,12 @@ def set_id(self, id):
def get_id(self):
return self.id

def set_icon(self, icon):
self.icon = icon

def get_icon(self):
return self.icon

def set_name(self, name):
self.name = name

Expand Down
10 changes: 10 additions & 0 deletions contributions/api/utils/datasetutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ def update_capability_dataset_from_json(dataset, injson):
del outjson['description']
except:
pass
try:
dataset.set_icon(injson['icon'])
del outjson['icon']
except:
pass
try:
dataset.set_is_open_source(injson['isOpenSource'])
del outjson['isOpenSource']
Expand Down Expand Up @@ -359,6 +364,11 @@ def update_talent_dataset_from_json(dataset, injson):
del outjson['name']
except:
pass
try:
dataset.set_icon(injson['icon'])
del outjson['icon']
except:
pass
try:
dataset.set_short_description(injson['shortDescription'])
del outjson['shortDescription']
Expand Down
20 changes: 18 additions & 2 deletions contributions/catalog/catalog_rest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import logging
import json
import os
import utils.requestutil as requestutil
import utils.jsonutil as jsonutil
Expand Down Expand Up @@ -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())
Expand All @@ -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():
Expand Down
40 changes: 38 additions & 2 deletions contributions/catalog/controllers/contribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
Blueprint, render_template, request, session, redirect, url_for
)
from requests_oauthlib import OAuth2Session
from formencode import variabledecode
from .auth import login_required
from controllers.config import Config as cfg
from utils import jsonutil
Expand Down Expand Up @@ -247,6 +246,22 @@ def contribution_edit(contribution_id):
s = "You don't have a permission to edit the contribution."
return render_template('contribute/error.html', error_msg=s)


@bp.route('/contributions/<contribution_id>/delete', methods=['GET'])
@login_required
def contribution_delete(contribution_id):
try:
response, s = delete_contribution(contribution_id)
if response:
return redirect(url_for('.home'))
else:
s = "There is a error in deleting contribution"
return render_template('contribute/error.html', error_msg=s)
except:
s = "There is a error in contribution id"
return render_template('contribute/error.html', error_msg=s)


@bp.route('/contributions/<contribution_id>/review', methods=['GET', 'POST'])
@login_required
def contribution_review(contribution_id):
Expand Down Expand Up @@ -580,7 +595,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,
Expand All @@ -599,6 +613,28 @@ def put_contribution(json_data, contribution_id):
var = "There was an error when updating your Contribution. Please try again later!"
return False, var

# DELETE a contribution using id
def delete_contribution(contribution_id):
headers = requestutil.get_header_using_session(session)
try:
# set DELETE url
delete_url = cfg.CONTRIBUTION_BUILDING_BLOCK_URL + "/" + contribution_id

# Setting up delete request
result = requests.delete(delete_url, headers=headers)
if result.status_code == 200 or result.status_code == 202:
logging.info("Contribution {} DELETE OK.".format(contribution_id))
return True, str("Your Contribution has been successfully deleted.")
else:
logging.error("DELETE method failed. " + str(result.text))
return False, str("Error Code: " + str(result.status_code) +
". There was an error when deleting your Contribution. Please try again later!")
except Exception:
traceback.print_exc()
logging.error("Delete method failed. ")
msg = "There was an error when deleting your Contribution. Please try again later!"
return False, msg

def get_contribution(contribution_id):
headers = requestutil.get_header_using_session(session)

Expand Down
15 changes: 10 additions & 5 deletions contributions/catalog/models/capability_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import uuid
import re

def init_capability():
d = {'id': '',
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions contributions/catalog/models/talent_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def init_talent():
d = {
'id': '',
"name": '',
"icon": None,
"shortDescription": '',
"longDescription": '',
"requiredCapabilities": [],
Expand Down
7 changes: 7 additions & 0 deletions contributions/catalog/utils/jsonutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion contributions/catalog/webapps/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ hr.dotted {
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
Expand Down
Loading

0 comments on commit 53cab3e

Please sign in to comment.