Skip to content

Commit

Permalink
Merge de85db0 into 2c0edb7
Browse files Browse the repository at this point in the history
  • Loading branch information
Avantol13 committed Jun 28, 2019
2 parents 2c0edb7 + de85db0 commit 4cdff18
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 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 "*" in self.authz or "/open" in 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 @@ -827,8 +829,3 @@ def filter_auth_ids(action, list_auth_ids):
if checked_permission in values:
authorized_dbgaps.append(key)
return authorized_dbgaps


def check_public(set_acls):
if "*" in set_acls:
return True

0 comments on commit 4cdff18

Please sign in to comment.