Beispiel #1
0
 public boolean userCanWriteBucket(final String bucketName, final String userName) {
   LOG.debug(String.format("userCanWriteBucket(%s, %s)", bucketName, userName));
   CannedAclPolicy cannedAclPolicy = getCannedAclForBucket(bucketName);
   if (null == cannedAclPolicy) throw new NoSuchBucketException();
   LOG.debug(String.format("CannedAclPolicy %s for bucket %s", cannedAclPolicy, bucketName));
   return CannedAclPolicy.PUBLIC_READ_WRITE.equals(cannedAclPolicy);
 }
Beispiel #2
0
 private boolean userCanReadBucket(final String bucketName, final String userName) {
   LOG.debug(String.format("userCanReadBucket(%s, %s)", bucketName, userName));
   CannedAclPolicy cannedAclPolicy = getCannedAclForBucket(bucketName);
   if (null == cannedAclPolicy) throw new NoSuchBucketException();
   LOG.debug(
       String.format("Canned acl policy for %s is %s", bucketName, cannedAclPolicy.getName()));
   if (CannedAclPolicy.PUBLIC_READ.equals(cannedAclPolicy)) return true;
   if (CannedAclPolicy.PUBLIC_READ_WRITE.equals(cannedAclPolicy)) return true;
   if (CannedAclPolicy.AUTHENTICATED_READ.equals(cannedAclPolicy)
       && !userName.equals(AuthenticationFilter.ANONYMOUS_USER)) return true;
   return false;
 }