Skip to content

Commit

Permalink
Merge pull request #894 from rokwire/release/1.13.0
Browse files Browse the repository at this point in the history
Release/1.13.0
  • Loading branch information
sandeep-ps authored Apr 4, 2022
2 parents 9236116 + b1700c2 commit 7c09b3d
Show file tree
Hide file tree
Showing 36 changed files with 1,230 additions and 259 deletions.
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [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)
- Talent form bug fixed in Contribution Catalog. [#857](https://github.com/rokwire/rokwire-building-blocks-api/issues/857)
- `imageURL` field name in Events BB API Doc. [#846](https://github.com/rokwire/rokwire-building-blocks-api/issues/846)
- Build error in Events BB. [#884](https://github.com/rokwire/rokwire-building-blocks-api/issues/884)

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

### Changed
- All group event user can GET and DELETE group event. [#847](https://github.com/rokwire/rokwire-building-blocks-api/issues/847)
- CODEOWNERS file. [#826](https://github.com/rokwire/rokwire-building-blocks-api/issues/826)

### Security
- Change string comparisons to constant time comparisons in Profile BB. [#850](https://github.com/rokwire/rokwire-building-blocks-api/issues/850)

## [1.12.1] - 2021-12-08
### Changed
- Contributions Catalog login callback endpoint to /catalog/auth/callback. [#803](https://github.com/rokwire/rokwire-building-blocks-api/issues/803)
Expand All @@ -17,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security
- String comparisons to constant time comparisons in auth middleware library. [#825](https://github.com/rokwire/rokwire-building-blocks-api/issues/825)
- Removed unused method in token utility. [#837](https://github.com/rokwire/rokwire-building-blocks-api/issues/837)

## [1.12.0] - 2021-11-19
### Added
Expand Down Expand Up @@ -425,7 +447,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.12.1...HEAD
[Unreleased]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.13.0...HEAD
[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
[1.11.3]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.11.2...1.11.3
Expand All @@ -451,4 +474,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
21 changes: 9 additions & 12 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
# Default assignment
* @sandeep-ps
* @sandeep-ps

# App Config Building Block
/appconfigservice/ @wenjzhu

# Authentication Building Block
/authservice/ @wenjzhu
/appconfigservice/ @minump

# Authentication Middleware Library
/lib/auth-middleware/ @ywkim312
/lib/auth-middleware/ @ywkim312

# API Doc
/Dockerfile @sandeep-ps
/README @sandeep-ps

# Events Building Block
/eventservice/ @bingzhang
/eventservice/ @bingzhang

# Logging Building Block
/loggingservice/ @ywkim312
/loggingservice/ @ywkim312

# Profile Building Block
/profileservice/ @ywkim312
/profileservice/ @ywkim312

# Contributions Building Block
/contributions/* @ywkim312
/contributions/api/ @ywkim312
/contributions/* @ywkim312
/contributions/api/ @ywkim312

# Contributions Catalog
/contributions/catalog/ @wenjzhu
/contributions/catalog/ @minump
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.13.0 | :white_check_mark: |
| 1.12.1 | :white_check_mark: |
| 1.12.0 | :white_check_mark: |
| 1.11.3 | :white_check_mark: |
Expand Down
46 changes: 26 additions & 20 deletions contributions/api/controllers/contributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,16 @@ def post(token_info):
required_cap_list = talent.requiredCapabilities
for capability_json in required_cap_list:
capability, rest_capability_json, msg = modelutils.construct_required_capability(capability_json)
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)
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)
talent_list.append(talent)
contribution_dataset.set_talents(talent_list)
except:
Expand Down Expand Up @@ -262,7 +263,10 @@ def get(token_info=None, id=None):
if is_error:
return resp
jsonutils.convert_obejctid_from_dataset_json(data_list[0])
out_json = mongoutils.construct_json_from_query_list(data_list[0])

out_json = mongoutils.construct_json_from_query_list(data_list[0], login_id=login_id)


msg_json = jsonutils.create_log_json("Contribution", "GET", {"id": str(id)})
logging.info("Contribution GET " + json.dumps(jsonutils.remove_objectid_from_dataset(msg_json)))

Expand Down Expand Up @@ -359,15 +363,16 @@ def put(token_info, id):
required_cap_list = talent.requiredCapabilities
for capability_json in required_cap_list:
capability, rest_capability_json, msg = modelutils.construct_capability(capability_json)
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)
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)

talent_list.append(talent)
contribution_dataset.set_talents(talent_list)
Expand All @@ -388,7 +393,7 @@ def put(token_info, id):
out_json = contribution_dataset
msg_json = jsonutils.create_log_json("Contribution", "PUT", {"id": str(id)})
logging.info("Contribution PUT " + json.dumps(msg_json))
out_json = mongoutils.construct_json_from_query_list(out_json)
out_json = mongoutils.construct_json_from_query_list(out_json, login_id=token_info["login"])

return out_json

Expand Down Expand Up @@ -853,6 +858,7 @@ def admin_reviewers_post(token_info):
in_json = request.get_json()
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)
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 @@ -20,6 +20,7 @@ def __init__(self, injson):
self.name = None
self.description = None
self.isOpenSource = None
self.sourceRepoUrl = None
self.apiDocUrl = None
self.deploymentDetails = None
self.apiBaseUrl = None
Expand Down Expand Up @@ -56,6 +57,12 @@ def set_is_open_source(self, isOpenSource):
def get_is_open_source(self):
return self.isOpenSource

def set_source_repo_url(self, sourceRepoUrl):
self.sourceRepoUrl = sourceRepoUrl

def get_source_repo_url(self):
return self.sourceRepoUrl

def set_api_doc_url(self, apiDocUrl):
self.apiDocUrl = apiDocUrl

Expand Down
7 changes: 7 additions & 0 deletions contributions/api/models/contribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, injson):
self.capabilities = None
self.talents = None
self.status = None
self.review = None
self.dateCreated = None
self.dateModified = None

Expand Down Expand Up @@ -72,6 +73,12 @@ def set_status(self, status):
def get_status(self):
return self.status

def set_review(self, review):
self.review = review

def get_review(self):
return self.review

def set_contributors(self, contributors):
self.contributors = contributors

Expand Down
41 changes: 41 additions & 0 deletions contributions/api/models/review.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2020 Board of Trustees of the University of Illinois.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import utils.datasetutils as datasetutils

class Review:
def __init__(self, injson):
self.reviewerId = None
self.reviewComment = None
self.reviewLastUpdated = None

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

def set_reviewer_id(self, reviewerId):
self.reviewerId = reviewerId

def get_reviewer_id(self):
return self.reviewerId

def set_review_comment(self, reviewComment):
self.reviewComment = reviewComment

def get_review_comment(self):
return self.reviewComment

def set_review_last_updated(self, reviewLastUpdated):
self.reviewLastUpdated = reviewLastUpdated

def get_review_last_updated(self):
return self.reviewLastUpdated
7 changes: 7 additions & 0 deletions contributions/api/models/reviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Reviewer:
def __init__(self, injson):
self.name = None
self.githubUsername = None
self.email = None
self.dateCreated = None

self, restjson = datasetutils.update_reviwer_dataset_from_json(self, injson)
Expand All @@ -34,6 +35,12 @@ def set_github_username(self, githubUsername):
def get_github_username(self):
return self.githubUsername

def set_email(self, email):
self.email = email

def get_email(self):
return self.email

def set_date_created(self, dateCreated):
self.dateCreated = dateCreated

Expand Down
38 changes: 38 additions & 0 deletions contributions/api/utils/datasetutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def update_contribution_dataset_from_json(dataset, injson):
del outjson['talents']
except:
pass
try:
dataset.set_review(injson['review'])
del outjson['review']
except:
pass
try:
dataset.set_status(injson["status"])
del outjson["status"]
Expand Down Expand Up @@ -141,6 +146,11 @@ def update_capability_dataset_from_json(dataset, injson):
del outjson['isOpenSource']
except:
pass
try:
dataset.set_source_repo_url(injson['sourceRepoUrl'])
del outjson['sourceRepoUrl']
except:
pass
try:
dataset.set_api_doc_url(injson['apiDocUrl'])
del outjson['apiDocUrl']
Expand Down Expand Up @@ -428,6 +438,29 @@ def update_talent_dataset_from_json(dataset, injson):

return dataset, outjson

"""
update review dataset
"""
def update_review_dataset_from_json(dataset, injson):
outjson = copy.copy(injson)
try:
dataset.set_reviewer_id(injson['reviewerId'])
del outjson['reviewerId']
except:
pass
try:
dataset.set_review_comment(injson['reviewComment'])
del outjson['reviewComment']
except:
pass
try:
dataset.set_review_comment(injson['reviewLastUpdate'])
del outjson['reviewLastUpdated']
except:
pass

return dataset, outjson

"""
update required capability dataset
"""
Expand Down Expand Up @@ -466,5 +499,10 @@ def update_reviwer_dataset_from_json(dataset, injson):
del outjson['githubUsername']
except:
pass
try:
dataset.set_email(injson['email'])
del outjson['email']
except:
pass

return dataset, outjson
12 changes: 10 additions & 2 deletions contributions/api/utils/mongoutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from models.contribution import Contribution
from utils import query_params
from utils import jsonutils
from utils import adminutils

client_contribution = MongoClient(cfg.MONGO_CONTRIBUTION_URL, connect=False)
db_contribution = client_contribution[cfg.CONTRIBUTION_DB_NAME]
Expand Down Expand Up @@ -304,8 +305,15 @@ def query_dataset_no_status(db_collection, fld, query_str):
"""
construct json from mongo query
"""
def construct_json_from_query_list(data_list):
data_dump = dumps(data_list)
def construct_json_from_query_list(in_json, login_id=None):
# check if the user is a reviewer or admin, otherwise, remove review from the output
if login_id is not None:
is_reviewer = adminutils.check_if_reviewer(login_id)
# remove review if the requested user is not reviewer
if not is_reviewer:
if "review" in in_json:
del in_json["review"]
data_dump = dumps(in_json)
out_json = make_response(data_dump)
out_json.mimetype = 'application/json'

Expand Down
Loading

0 comments on commit 7c09b3d

Please sign in to comment.