Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix delete endpoints in Single Table #383

Merged
merged 4 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ RUN COMMIT=`git rev-parse HEAD` && echo "COMMIT=\"${COMMIT}\"" >$appname/index/v
# directory where the app can find Alembic files
WORKDIR /indexd

CMD /dockerrun.sh
CMD ["/dockerrun.sh"]
14 changes: 7 additions & 7 deletions indexd/index/drivers/single_table_alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def update_blank_record(self, did, rev, size, hashes, urls, authz=None):
if authz:
# if an authz is provided, ensure that user can actually
# create/update for that resource (old authz and new authz)
old_authz = [u for u in record.authz] if record.authz else []
old_authz = record.authz if record.authz else []
all_authz = old_authz + authz
try:
auth.authorize("update", all_authz)
Expand Down Expand Up @@ -651,7 +651,7 @@ def append_aliases_for_did(self, aliases, did):

# authorization
try:
resources = [u.resource for u in index_record.authz]
resources = index_record.authz
auth.authorize("update", resources)
except AuthError as err:
self.logger.warning(
Expand Down Expand Up @@ -692,7 +692,7 @@ def replace_aliases_for_did(self, aliases, did):

# authorization
try:
resources = [u.resource for u in index_record.authz]
resources = index_record.authz
auth.authorize("update", resources)
except AuthError as err:
self.logger.warning(
Expand Down Expand Up @@ -732,7 +732,7 @@ def delete_all_aliases_for_did(self, did):

# authorization
try:
resources = [u.resource for u in index_record.authz]
resources = index_record.authz
auth.authorize("delete", resources)
except AuthError as err:
self.logger.warning(
Expand Down Expand Up @@ -762,7 +762,7 @@ def delete_one_alias_for_did(self, alias, did):

# authorization
try:
resources = [u.resource for u in index_record.authz]
resources = index_record.authz
auth.authorize("delete", resources)
except AuthError as err:
self.logger.warning(
Expand Down Expand Up @@ -935,7 +935,7 @@ def delete(self, guid, rev):
if rev != record.rev:
raise RevisionMismatch("revision mismatch")

auth.authorize("delete", [u.resource for u in record.authz])
auth.authorize("delete", record.authz)

session.delete(record)

Expand Down Expand Up @@ -977,7 +977,7 @@ def add_version(
except MultipleResultsFound:
raise MultipleRecordsFound("multiple records found")

auth.authorize("update", [u for u in record.authz] + authz)
auth.authorize("update", record.authz + authz)

baseid = record.baseid
record = Record()
Expand Down
Loading
Loading