Skip to content

Commit

Permalink
merge develop into main (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanvit authored Apr 1, 2024
2 parents 992c320 + b3c2b2d commit 91f0c1c
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 34 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ 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]
[2.4.1] - 2024-04-01
### Fixed
- Fix webtools blacklist APIs [#62](https://github.com/rokwire/gateway-building-block/issues/62)

[2.4.0] - 2024-03-29
### Added
- Ability to block/blacklist specific Webtools events [#57](https://github.com/rokwire/gateway-building-block/issues/57)
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Patches for **Gateway Building Block** in this repository will only be applied to the following versions:
| Version | Supported |
| ------- | ------------------ |
| 2.4.0 | :white_check_mark: |
| < 2.4.0 | :x: |
| 2.4.1 | :white_check_mark: |
| < 2.4.1 | :x: |

## Reporting a Bug or Vulnerability

Expand Down
40 changes: 22 additions & 18 deletions driven/storage/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,28 +401,32 @@ func (a *Adapter) AddWebtoolsBlacklistData(dataSourceIDs []string, dataCalendarI

// RemoveWebtoolsBlacklistData update data from the database
func (a *Adapter) RemoveWebtoolsBlacklistData(dataSourceIDs []string, dataCalendarIDs []string) error {
filterSource := bson.M{"name": "webtools_events_ids"}
updateSource := bson.M{
"$pull": bson.M{
"data": bson.M{"$in": dataSourceIDs},
},
}
if dataSourceIDs != nil {
filterSource := bson.M{"name": "webtools_events_ids"}
updateSource := bson.M{
"$pull": bson.M{
"data": bson.M{"$in": dataSourceIDs},
},
}

_, err := a.db.webtoolsBlacklistItems.UpdateOne(a.context, filterSource, updateSource, nil)
if err != nil {
return errors.WrapErrorAction(logutils.ActionUpdate, model.TypeExample, filterArgs(filterSource), err)
_, err := a.db.webtoolsBlacklistItems.UpdateOne(a.context, filterSource, updateSource, nil)
if err != nil {
return errors.WrapErrorAction(logutils.ActionUpdate, model.TypeExample, filterArgs(filterSource), err)
}
}
if dataCalendarIDs != nil {
filterCalendar := bson.M{"name": "webtools_calendar_ids"}
updateCalendar := bson.M{
"$pull": bson.M{
"data": bson.M{"$in": dataCalendarIDs},
},
}

filterCalendar := bson.M{"name": "webtools_calendar_ids"}
updateCalendar := bson.M{
"$pull": bson.M{
"data": bson.M{"$in": dataCalendarIDs},
},
}
_, err := a.db.webtoolsBlacklistItems.UpdateOne(a.context, filterCalendar, updateCalendar, nil)
if err != nil {
return errors.WrapErrorAction(logutils.ActionUpdate, model.TypeExample, filterArgs(filterCalendar), err)
}

_, err = a.db.webtoolsBlacklistItems.UpdateOne(a.context, filterCalendar, updateCalendar, nil)
if err != nil {
return errors.WrapErrorAction(logutils.ActionUpdate, model.TypeExample, filterArgs(filterCalendar), err)
}

return nil
Expand Down
20 changes: 10 additions & 10 deletions driver/web/apis_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,20 +245,20 @@ func (h AdminAPIsHandler) addwebtoolsblacklist(l *logs.Log, r *http.Request, cla
}

var dataSourceIDs []string
for _, w := range *requestData.DataSourceIds {
if w != "" {
dataSourceIDs = append(dataSourceIDs, w)
} else {
dataSourceIDs = nil
if requestData.DataSourceIds != nil {
for _, w := range *requestData.DataSourceIds {
if w != "" {
dataSourceIDs = append(dataSourceIDs, w)
}
}
}

var dataCalendarIDs []string
for _, w := range *requestData.DataCalendarIds {
if w != "" {
dataCalendarIDs = append(dataCalendarIDs, w)
} else {
dataCalendarIDs = nil
if requestData.DataCalendarIds != nil {
for _, w := range *requestData.DataCalendarIds {
if w != "" {
dataCalendarIDs = append(dataCalendarIDs, w)
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion driver/web/docs/gen/def.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Rokwire Gateway Building Block API
description: Gateway Building Block API Documentation
version: 2.4.0
version: 2.4.1
servers:
- url: 'https://api.rokwire.illinois.edu/gateway'
description: Production server
Expand Down Expand Up @@ -475,10 +475,12 @@ paths:
properties:
data_source_ids:
type: array
nullable: true
items:
type: string
data_calendar_ids:
type: array
nullable: true
items:
type: string
responses:
Expand Down
4 changes: 2 additions & 2 deletions driver/web/docs/gen/gen_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion driver/web/docs/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Rokwire Gateway Building Block API
description: Gateway Building Block API Documentation
version: 2.4.0
version: 2.4.1
servers:
- url: 'https://api.rokwire.illinois.edu/gateway'
description: Production server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ type: object
properties:
data_source_ids:
type: array
nullable: true
items:
type: string
data_calendar_ids:
type: array
nullable: true
items:
type: string

0 comments on commit 91f0c1c

Please sign in to comment.