Skip to content

Commit

Permalink
Merge 880e6c2 into 2c0edb7
Browse files Browse the repository at this point in the history
  • Loading branch information
Avantol13 committed Jun 27, 2019
2 parents 2c0edb7 + 880e6c2 commit 642290c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions fence/blueprints/data/indexd.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,10 @@ def _get_signed_url(self, protocol, action, expires_in, force_signed_url):
)

@cached_property
def set_acls(self):
if "acl" in self.index_document:
def authz(self):
if "authz" in self.index_document:
return set(self.index_document["authz"])
elif "acl" in self.index_document:
return set(self.index_document["acl"])
elif "acls" in self.metadata:
return set(self.metadata["acls"].split(","))
Expand All @@ -365,7 +367,7 @@ def metadata(self):

@cached_property
def public(self):
return check_public(self.set_acls)
return check_public(self.authz)

@login_required({"data"})
def check_authorization(self, action):
Expand Down Expand Up @@ -399,7 +401,7 @@ def check_authorization(self, action):
given_acls = set(
filter_auth_ids(action, flask.g.token["context"]["user"]["projects"])
)
return len(self.set_acls & given_acls) > 0
return len(self.authz & given_acls) > 0

@login_required({"data"})
def delete_files(self, urls=None, delete_all=True):
Expand Down Expand Up @@ -829,6 +831,6 @@ def filter_auth_ids(action, list_auth_ids):
return authorized_dbgaps


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

0 comments on commit 642290c

Please sign in to comment.