Skip to content

Commit e22f99e

Browse files
authored
22.11 (#150)
* Changes to be committed: modified: bco_api/bco_api/settings.py modified: bco_api/server.conf * Enable Group and Prefix to be open to all users. Changes to be committed: modified: bco_api/api/permissions.py modified: bco_api/server.conf * Enable Prefix creation from the ui Changes to be committed: modified: bco_api/api/model/groups.py modified: bco_api/api/model/prefix.py modified: bco_api/api/scripts/method_specific/POST_api_objects_drafts_modify.py modified: bco_api/api/views.py modified: bco_api/bco_api/settings.py * Docker building Changes to be committed: modified: Dockerfile modified: admin_only/bco_api.conf modified: bco_api/bco_api/settings.py modified: bco_api/server.conf new file: docker-compose.yml * Docker support on release Changes to be committed: new file: .github/workflows/publish-Docker-image * testing Changes to be committed: renamed: .github/workflows/publish-Docker-image -> .github/workflows/release-package.yml * Push to dockerhub Changes to be committed: modified: Dockerfile deleted: apitests.py deleted: apitests_new.py deleted: bco_api/static/img/android-chrome-192x192.png deleted: bco_api/static/img/android-chrome-512x512.png deleted: bco_api/static/img/apple-touch-icon.png deleted: bco_api/static/img/favicon-16x16.png deleted: bco_api/static/img/favicon-32x32.png deleted: bco_api/static/img/favicon.ico deleted: cag.sh deleted: curl_fetch.txt modified: docker-compose.yml * Fix Extension domain validation * linting Changes to be committed: modified: bco_api/api/model/groups.py modified: bco_api/api/model/prefix.py modified: bco_api/api/models.py modified: bco_api/api/permissions.py modified: bco_api/api/scripts/utilities/JsonUtils.py modified: bco_api/bco_api/settings.py modified: bco_api/server.conf
1 parent d9e059f commit e22f99e

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

bco_api/api/model/groups.py

100755100644
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ def post_api_groups_modify(request):
337337

338338
if "owner_user" in action_set:
339339
# Make sure the provided owner user exists.
340-
if usr_utils.check_user_exists(user_name=action_set["owner_user"]):
340+
if usr_utils.check_user_exists(
341+
user_name=action_set["owner_user"]
342+
):
341343
group_information.owner_user = User.objects.get(
342344
username=action_set["owner_user"]
343345
)

bco_api/api/model/prefix.py

100755100644
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Generic meta data model
2323
# TODO: rename to prefix_meta
2424
class prefix_table(models.Model):
25-
""" The number of objects for a given prefix."""
25+
"""The number of objects for a given prefix."""
2626

2727
# Field is required.
2828
n_objects = models.IntegerField()
@@ -93,8 +93,8 @@ def post_api_prefixes_create(request):
9393
return_data = []
9494
any_failed = False
9595
for creation_object in bulk_request:
96-
owner_user = User.objects.get(username=creation_object['owner_user'])
97-
if creation_object['owner_group'] == 'bco_drafter':
96+
owner_user = User.objects.get(username=creation_object["owner_user"])
97+
if creation_object["owner_group"] == "bco_drafter":
9898
is_public = True
9999
else:
100100
is_public = False
@@ -136,9 +136,9 @@ def post_api_prefixes_create(request):
136136
is not None
137137
):
138138
return_data.append(
139-
db_utils.messages(parameters={"expiration_date": prfx["expiration_date"]})[
140-
"400_invalid_expiration_date"
141-
]
139+
db_utils.messages(
140+
parameters={"expiration_date": prfx["expiration_date"]}
141+
)["400_invalid_expiration_date"]
142142
)
143143
any_failed = True
144144
continue
@@ -157,7 +157,7 @@ def post_api_prefixes_create(request):
157157
owner_user.groups.add(drafters)
158158
GroupInfo.objects.create(
159159
delete_members_on_group_deletion=False,
160-
description=prfx['description'],
160+
description=prfx["description"],
161161
group=drafters,
162162
max_n_members=-1,
163163
owner_user=owner_user,
@@ -172,13 +172,13 @@ def post_api_prefixes_create(request):
172172
owner_user.groups.add(publishers)
173173
GroupInfo.objects.create(
174174
delete_members_on_group_deletion=False,
175-
description=prfx['description'],
175+
description=prfx["description"],
176176
group=publishers,
177177
max_n_members=-1,
178178
owner_user=owner_user,
179179
)
180180
if is_public is True:
181-
owner_group = 'bco_drafter'
181+
owner_group = "bco_drafter"
182182
else:
183183
owner_group = publish
184184

@@ -212,9 +212,9 @@ def post_api_prefixes_create(request):
212212
continue
213213

214214
return_data.append(
215-
db_utils.messages(
216-
parameters={"prefix": standardized}
217-
)["201_prefix_create"]
215+
db_utils.messages(parameters={"prefix": standardized})[
216+
"201_prefix_create"
217+
]
218218
)
219219
# Created the prefix.
220220
# errors["201_prefix_create"] = db_utils.messages(
@@ -223,7 +223,7 @@ def post_api_prefixes_create(request):
223223

224224
# Append the possible "errors".
225225
if any_failed and len(return_data) == 1:
226-
return Response(status=return_data[0]['status_code'], data=return_data)
226+
return Response(status=return_data[0]["status_code"], data=return_data)
227227

228228
if any_failed and len(return_data) > 1:
229229
return Response(status=status.HTTP_207_MULTI_STATUS, data=return_data)

bco_api/api/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class BCO(models.Model):
5151
schema: str
5252
schema to which the BCO should be validated. Default is 'IEEE'
5353
state:str
54-
State of object. PUBLISHED, DRAFT, and DELETE are currently accepted values.
54+
State of object. REFERENCED, PUBLISHED, DRAFT, and DELETE are currently accepted values.
5555
last_update: DateTime
5656
Date Time object for the last database change to this object
5757
"""

bco_api/api/permissions.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919

2020
class RequestorInGroupAdminsGroup(permissions.BasePermission):
2121
"""Class docstring"""
22+
2223
def has_permission(self, request, view):
2324
"""Check to see if the requester is in the group admins group.
24-
Get the groups for this token (user).
25-
This means getting the user ID for the token,
26-
then the username."""
25+
Get the groups for this token (user).
26+
This means getting the user ID for the token,
27+
then the username."""
2728

2829
user_id = Token.objects.get(
2930
key=request.META.get("HTTP_AUTHORIZATION").split(" ")[1]
@@ -64,9 +65,7 @@ def has_permission(self, request, view):
6465
).user_id
6566

6667
username = User.objects.get(id=user_id)
67-
6868
prefix_admins = Group.objects.filter(user=username, name="prefix_admins")
69-
import pdb; pdb.set_trace()
7069
return len(prefix_admins) > 0
7170

7271
else:

bco_api/api/scripts/utilities/JsonUtils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def parse_bco(bco, results):
123123

124124
results = validate(spec_version, bco, results)
125125
if "extension_domain" in bco.keys():
126-
if bco["extension_domain"] is not list:
126+
if isinstance(bco["extension_domain"], list) is False:
127127
results[identifier]["extension_domain"] = {
128128
"number_of_errors": 1,
129129
"error_detail": ["extension_doamin invalid"],

bco_api/bco_api/settings.py

100755100644
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
HUMAN_READABLE_HOSTNAME = server_config["HRHOSTNAME"]["hrnames"]
4343

4444
if server_config["GROUP_PREFIX"]["allow_all_creation"] == "True":
45-
GROUP=True
46-
PREFIX=True
45+
GROUP = True
46+
PREFIX = True
4747
elif server_config["GROUP_PREFIX"]["allow_group_creation"] == "True":
48-
GROUP=True
48+
GROUP = True
4949
elif server_config["GROUP_PREFIX"]["allow_prefix_creation"] == "True":
50-
PREFIX=True
50+
PREFIX = True
5151

5252
# The publicly accessible hostname.
5353
if server_config["PRODUCTION"]["production"] == "True":
@@ -185,7 +185,7 @@
185185
"SECURITY_DEFINITIONS": {
186186
"Bearer": {"type": "apiKey", "name": "Authorization", "in": "header"}
187187
},
188-
"DEEP_LINKING": True
188+
"DEEP_LINKING": True,
189189
}
190190

191191
REDOC_SETTINGS = {"LAZY_RENDERING": False}

bco_api/server.conf

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ production=False
77

88
# DB Version
99
[VERSION]
10-
version=22.08
10+
version=22.11
1111

1212
# NOTE: Valid values are True or False (note the capitalization).
1313
# Is this a publish-only server?

0 commit comments

Comments
 (0)