Skip to content

Commit

Permalink
Merge pull request #926 from rokwire/release/1.14.0
Browse files Browse the repository at this point in the history
Release/1.14.0
  • Loading branch information
sandeep-ps authored May 19, 2022
2 parents 7c09b3d + 5609965 commit 71165e1
Show file tree
Hide file tree
Showing 36 changed files with 2,202 additions and 1,592 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*/.env
**/*.env
37 changes: 34 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.14.0] - 2022-05-17
### Added
- Sending email to reviewers. [#839](https://github.com/rokwire/rokwire-building-blocks-api/issues/839)
- Self certification information to talent [#878](https://github.com/rokwire/rokwire-building-blocks-api/issues/878)
- Items in contact details are added to required field data validation [#907](https://github.com/rokwire/rokwire-building-blocks-api/issues/907)
- Version endpoint to contribution building block [#897](https://github.com/rokwire/rokwire-building-blocks-api/issues/897)
- Version endpoint to logging building block [#898](https://github.com/rokwire/rokwire-building-blocks-api/issues/898)
- Endpoint for showing required building blocks to contribution building block [#904](https://github.com/rokwire/rokwire-building-blocks-api/issues/904)
- Multiple selection list for required building block added to talent [#917](https://github.com/rokwire/rokwire-building-blocks-api/issues/917)
- Hide and toggle sensitive data. [#905](https://github.com/rokwire/rokwire-building-blocks-api/issues/905)

### Changed
- Modified required capability in talent detail page [#877](https://github.com/rokwire/rokwire-building-blocks-api/issues/877)
- Minimum end user role as text in talent detail page [#879](https://github.com/rokwire/rokwire-building-blocks-api/issues/879)
- Made person and organization display order more consistence in catalog [#908](https://github.com/rokwire/rokwire-building-blocks-api/issues/908)
- Show general html values instead of raw data format in catalog [#909](https://github.com/rokwire/rokwire-building-blocks-api/issues/909)
- Contact information in contribution detail page shows html formatted data [#914](https://github.com/rokwire/rokwire-building-blocks-api/issues/914)
- Environmental variables in capability detail page shows html formatted data [#915](https://github.com/rokwire/rokwire-building-blocks-api/issues/915)

### Fixed
- Posting contribution error when required capability is empty in talent [#874](https://github.com/rokwire/rokwire-building-blocks-api/issues/874)
- End user role in posting doesn't update multiple selection [#870](https://github.com/rokwire/rokwire-building-blocks-api/issues/870)
- Show and hide of source repo url based on the selection of open source [#869](https://github.com/rokwire/rokwire-building-blocks-api/issues/869)
- Saving multiple capabilities error [#858](https://github.com/rokwire/rokwire-building-blocks-api/issues/858)
- GET contributions returns 401 for unpublished contributions. [#826](https://github.com/rokwire/rokwire-building-blocks-api/issues/826)
- Warning in Logs Building Block. [#881](https://github.com/rokwire/rokwire-building-blocks-api/issues/881)
- Editing multiple talent and capabilities. [#883](https://github.com/rokwire/rokwire-building-blocks-api/issues/883)
- Contributor editing for person and organization. [#888](https://github.com/rokwire/rokwire-building-blocks-api/issues/888)
- Fix the Jinja version. [#893](https://github.com/rokwire/rokwire-building-blocks-api/issues/893)

## [1.13.0] - 2022-04-04
### Fixed
- UI changes to 'Source Repo URL' field in catalog. [#814](https://github.com/rokwire/rokwire-building-blocks-api/issues/814)
Expand All @@ -16,7 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Add a Review section to Contribution. [#756](https://github.com/rokwire/rokwire-building-blocks-api/issues/756)
- Error message text to event building block when it is internal sever error. [#840](https://github.com/rokwire/rokwire-building-blocks-api/issues/840)
- Added email field for reviewers. [#839](https://github.com/rokwire/rokwire-building-blocks-api/issues/839)
- Added email field for reviewers. [#864](https://github.com/rokwire/rokwire-building-blocks-api/issues/864)
- Add query filter to get events created by a user. [#873](https://github.com/rokwire/rokwire-building-blocks-api/issues/873)
- Add Aquatics and Intramural tags. [#872](https://github.com/rokwire/rokwire-building-blocks-api/issues/872)

Expand Down Expand Up @@ -447,7 +477,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.13.0...HEAD
[Unreleased]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.14.0...HEAD
[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
[1.12.0]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.11.3...1.12.0
Expand All @@ -474,4 +505,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[1.0.3]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.0.2...1.0.3
[1.0.2]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/rokwire/rokwire-building-blocks-api/releases/tag/1.0.0
[1.0.0]: https://github.com/rokwire/rokwire-building-blocks-api/releases/tag/1.0.0
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Patches for **Rokwire Building Blocks** in this repository will only be applied

| Version | Supported |
| ------- | ------------------ |
| 1.14.0 | :white_check_mark: |
| 1.13.0 | :white_check_mark: |
| 1.12.1 | :white_check_mark: |
| 1.12.0 | :white_check_mark: |
Expand Down
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.12.1
version: 1.14.0
servers:
- url: https://api.rokwire.illinois.edu
description: Production server
Expand Down
2 changes: 2 additions & 0 deletions appconfigservice/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Flask==1.1.1
itsdangerous==2.0.1
Jinja2==3.0.3
pymongo[tls,srv]==3.7.2
pytest==5.0.1
requests==2.22.0
Expand Down
2 changes: 2 additions & 0 deletions auth-middleware-test-svc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Flask==1.1.1
itsdangerous==2.0.1
Jinja2==3.0.3
gunicorn==20.0.4
connexion[swagger-ui]==2.9.0
python-dotenv==0.10.3
Expand Down
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.12.1
version: 1.14.0
paths:
/authentication/phone-initiate:
post:
Expand Down
2 changes: 2 additions & 0 deletions authservice/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Flask>=1.0.3,<1.1
itsdangerous==2.0.1
Jinja2==3.0.3
schema==0.7.0
connexion[swagger-ui]==2.9.0
requests==2.22.0
Expand Down
6 changes: 6 additions & 0 deletions contributions/api/controllers/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@
FIELD_NAME = 'name'

ADMIN_USERS = os.getenv('ADMIN_USERS', '')

NOTIFICATION_ENABLED = bool(os.getenv('NOTIFICATION_ENABLED', 'True') == 'True')
SMTP_HOST = os.getenv('SMTP_HOST', 'smtp.office365.com')
SMTP_PORT = os.getenv('SMTP_PORT', 587)
SENDER_EMAIL = os.getenv('SENDER_EMAIL', '')
SENDER_EMAIL_PASSWORD = os.getenv('SENDER_EMAIL_PASSWORD', '')
130 changes: 111 additions & 19 deletions contributions/api/controllers/contributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
import json
import datetime
import logging
import yaml
import os

from flask import wrappers, request
from flask import wrappers, request, current_app
from bson import ObjectId

import controllers.configs as cfg
Expand All @@ -30,10 +32,6 @@

from utils import query_params
from models.contribution import Contribution
from models.person import Person
from models.organization import Organization
from models.capabilities.capability import Capability
from models.talents.talent import Talent
from models.reviewer import Reviewer
from pymongo import MongoClient

Expand All @@ -42,6 +40,7 @@
db_contribution = client_contribution[cfg.CONTRIBUTION_DB_NAME]
coll_contribution = db_contribution[cfg.CONTRIBUTION_COLL_NAME]
coll_reviewer = db_contribution[cfg.REVIEWER_COLL_NAME]
notification_enabled = cfg.NOTIFICATION_ENABLED

def post(token_info):
is_new_install = True
Expand Down Expand Up @@ -200,6 +199,12 @@ def post(token_info):
msg_json = jsonutils.create_log_json("Contribution", "POST", {"id": str(contribution_id)})
logging.info("Contribution POST " + json.dumps(msg_json))

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

return rs_handlers.return_id(msg, 'id', contribution_id)

def search(token_info=None, name=None):
Expand Down Expand Up @@ -362,18 +367,15 @@ def put(token_info, id):
if talent.requiredCapabilities is not None:
required_cap_list = talent.requiredCapabilities
for capability_json in required_cap_list:
capability, rest_capability_json, msg = modelutils.construct_capability(capability_json)
if capability.id is not None:
is_uuid = otherutils.check_if_uuid(capability.id)
if not is_uuid:
msg = {
"reason": "Capability id in requiredCapabilities is not in uuid format",
"error": "Bad Request: " + request.url,
}
msg_json = jsonutils.create_log_json("Contribution", "POST", msg)
logging.error("Contribution POST " + json.dumps(msg_json))
return rs_handlers.bad_request(msg)

is_uuid = otherutils.check_if_uuid(capability_json["capabilityId"])
if not is_uuid:
msg = {
"reason": "Capability id in requiredCapabilities is not in uuid format",
"error": "Bad Request: " + request.url,
}
msg_json = jsonutils.create_log_json("Contribution", "POST", msg)
logging.error("Contribution POST " + json.dumps(msg_json))
return rs_handlers.bad_request(msg)
talent_list.append(talent)
contribution_dataset.set_talents(talent_list)
except:
Expand Down Expand Up @@ -839,6 +841,17 @@ def talents_get(token_info=None, id=None, talent_id=None):
def ok_search():
return rs_handlers.return_200("okay")

def version_search():
contribution_yaml = open('contribution.yaml')
parsed_contribution_yaml = yaml.load(contribution_yaml, Loader=yaml.FullLoader)
return parsed_contribution_yaml['info']['version']

def building_blocks_search():
with open(os.path.join(current_app.root_path, 'jsons', 'building_blocks_list.json')) as f:
json_data = json.load(f)

return json_data["buildingBlocks"]

def admin_reviewers_post(token_info):
# this is for adding reviewers to the database
# only superuser can add the reviewer
Expand All @@ -859,7 +872,6 @@ def admin_reviewers_post(token_info):
name = in_json["name"]
username = in_json["githubUsername"]
email = in_json["email"]

# check if the dataset is existing with given github username
dataset = mongoutils.get_dataset_from_field(coll_reviewer, "githubUsername", username)
if dataset is not None:
Expand All @@ -884,7 +896,10 @@ def admin_reviewers_post(token_info):
logging.info("Contribution Admin POST " + json.dumps(msg_json))

reviewer_id = str(dataset['_id'])

# send email when new reviewer is added
### TODO : This function is to be called when a reviewer is assigned to a contribution
if notification_enabled:
send_email_new_reviewer(dataset['githubUsername'])
return rs_handlers.return_id(msg, 'id', reviewer_id)

def admin_reviewers_search(token_info):
Expand Down Expand Up @@ -936,3 +951,80 @@ def admin_reviewers_delete(token_info, id):
msg_json = jsonutils.create_log_json("Contribution Admin ", "DELETE", msg)
logging.info("Contribution Admin DELETE " + json.dumps(msg_json))
return rs_handlers.not_found(msg_json)

def send_email_new_reviewer(username):
"""
Method to send email to user for new reviewers
Args:
username (str) : github username of reviewer
"""
# check if the dataset is existing with given github username
dataset = mongoutils.get_reviewers_record(username)
if dataset is None:
msg = {
"reason": "Github Username not present in the database: " + str(username),
"error": "Bad Request: " + request.url,
}
msg_json = jsonutils.create_log_json("Contribution Admin", "POST", msg)
logging.error("Contribution Admin POST " + json.dumps(msg_json))
return rs_handlers.bad_request(msg)

if 'email' in dataset[0].keys():
subject = "Reviewer updated"
message = "Reviewer has been updated for a contribution"
success, error_code, error_msg = adminutils.send_email(dataset[0]['email'], subject, message)
if not success:
msg = {
"reason": "Error in sending email via SMTP: " + str(error_msg),
"error": "Error code" + str(error_code)
}
msg_json = jsonutils.create_log_json("Contribution", "POST", msg)
logging.error("Contribution POST " + json.dumps(msg_json))
return rs_handlers.bad_request(msg)
else:
msg = {
"reason": "Email not present for username " + str(username)
}
msg_json = jsonutils.create_log_json("Contribution", "POST", msg)
logging.error("Contribution POST " + json.dumps(msg_json))
return rs_handlers.bad_request(msg)

def send_email_new_contribution(username, contribution_name):
"""
Method to send email to user for new contribution
Args:
username (str) : github username of reviewer
contribution_name (str): cfg.FIELD_NAME of contribution
"""
# check if the dataset is existing with given github username
dataset = mongoutils.get_reviewers_record(username)
if dataset is None:
msg = {
"reason": "Github Username not present in the database: " + str(username),
"error": "Bad Request: " + request.url,
}
msg_json = jsonutils.create_log_json("Contribution Admin", "POST", msg)
logging.error("Contribution Admin POST " + json.dumps(msg_json))
return rs_handlers.bad_request(msg)

if 'email' in dataset[0].keys():
subject = "New Rokwire Contribution Submitted"
message = "New contribution " + contribution_name + " has been added for your review"
success, error_code, error_msg = adminutils.send_email(dataset[0]['email'], subject, message)
if not success:
msg = {
"reason": "Error in sending email via SMTP: " + str(error_msg),
"error": "Error code" + str(error_code)
}
msg_json = jsonutils.create_log_json("Contribution", "POST", msg)
logging.error("Contribution POST " + json.dumps(msg_json))
return rs_handlers.bad_request(msg)
else:
msg = {
"reason": "Email not present for Github Username in the database: " + str(username),
"error": "Bad Request: " + request.url,
}
msg_json = jsonutils.create_log_json("Contribution Admin", "POST", msg)
logging.error("Contribution Admin POST " + json.dumps(msg_json))
return rs_handlers.bad_request(msg)

19 changes: 19 additions & 0 deletions contributions/api/jsons/building_blocks_list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"buildingBlocks" :
["Admin",
"App Config",
"Content",
"Core",
"Events",
"Groups",
"Learning Management System",
"Locations",
"Logs",
"Notifications",
"Polls",
"Rewards",
"Sports",
"Talent Chooser",
"Transportation"
]
}
7 changes: 7 additions & 0 deletions contributions/api/models/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@

class Organization:
def __init__(self, injson):
self.contributorType = None
self.name = None
self.address = None
self.email = None
self.phone = None

self, restjson = datasetutils.update_organization_dataset_from_json(self, injson)

def set_contributor_type(self, contributorType):
self.contributorType = contributorType

def get_contributor_type(self):
return self.contributorType

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

Expand Down
Loading

0 comments on commit 71165e1

Please sign in to comment.