Skip to content

Commit

Permalink
chore(revert): just check for /open
Browse files Browse the repository at this point in the history
  • Loading branch information
Avantol13 committed Jun 27, 2019
1 parent ca23962 commit e8d3a58
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions fence/blueprints/data/indexd.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"gs": {"upload": "PUT", "download": "GET"},
}

ACTION_TO_ARBORIST_METHOD = {"upload": "write-storage", "download": "read-storage"}

SUPPORTED_PROTOCOLS = ["s3", "http", "ftp", "https", "gs"]
SUPPORTED_ACTIONS = ["upload", "download"]
Expand Down Expand Up @@ -388,7 +387,8 @@ def check_authorization(self, action):
return self.index_document.get("uploader") == username

try:
method = ACTION_TO_ARBORIST_METHOD[action]
action_to_method = {"upload": "write-storage", "download": "read-storage"}
method = action_to_method[action]
# action should be upload or download
# return bool for authorization
return self.check_authz(method)
Expand Down Expand Up @@ -796,14 +796,6 @@ def _generate_google_storage_signed_url(
)
return final_url

def check_public(self, authz):
if "*" in authz or "/open" in authz:
return True
else:
# check if an anonymous user can access the file, if so, it's public
method = ACTION_TO_ARBORIST_METHOD["download"]
return self.check_authz(method, token="")


def _get_user_info():
"""
Expand Down Expand Up @@ -841,3 +833,8 @@ def filter_auth_ids(action, list_auth_ids):
if checked_permission in values:
authorized_dbgaps.append(key)
return authorized_dbgaps


def check_public(self, authz):
if "*" in authz or "/open" in authz:
return True

0 comments on commit e8d3a58

Please sign in to comment.