Skip to content

Commit

Permalink
Bugfix of bucket acl; update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
gaodunqiao committed Jan 23, 2018
1 parent 9ae09c0 commit 59354b3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion samples/java/S3Sample.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ public static void main(String[] args) throws IOException {

S3ClientOptions clientOptions = new S3ClientOptions();
clientOptions.setPathStyleAccess(true);
clientOptions.disableChunkedEncoding();

AmazonS3 s3 = new AmazonS3Client(customProvider);
s3.setEndpoint("https://zeppelin-gateway-host");
s3.setEndpoint("http://zeppelin-gateway-host");
s3.setS3ClientOptions(clientOptions);

String bucketName = "my-first-s3-bucket-" + UUID.randomUUID();
Expand Down
2 changes: 1 addition & 1 deletion samples/php/S3Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'version' => '2006-03-01',
'signature_version' => 'v4',
'use_path_style_endpoint' => true,
'endpoint' => 'https://zeppelin-gateway-host',
'endpoint' => 'http://zeppelin-gateway-host',
'credentials' => [
'key' => 'XXXXXXXXXXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
Expand Down
6 changes: 3 additions & 3 deletions samples/python/S3Sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from botocore.client import Config

s3_cli = boto3.client('s3', 'sh-bt-1',
config=Config(signature_version='s3v4'), use_ssl=True,
verify='/path-to/cacert.pem, or delete me and set use_ssl=False',
endpoint_url='https://zeppelin-gateway-host',
config=Config(signature_version='s3v4'), use_ssl=False,
# verify='/path-to/cacert.pem, or delete me and set use_ssl=False',
endpoint_url='http://zeppelin-gateway-host',
aws_secret_access_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
aws_access_key_id='XXXXXXXXXXXXXXXXXXXX')

Expand Down
7 changes: 3 additions & 4 deletions src/s3_cmds/zgw_s3_command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,17 @@ void DestroyCmdTable(S3CmdTable* cmd_table) {
}

bool S3Cmd::TryAuth() {
if (!bucket_name_.empty()) {
if ((flags() & kFlagsRead) && !bucket_name_.empty()) {
zgwstore::Bucket bkt;
std::string unuseful_name;
bool anonymous = true;
Status s = store_->GetBucket(unuseful_name, bucket_name_, &bkt, anonymous);
if (!s.ok()) {
http_ret_code_ = 403;
GenerateErrorXml(kInvalidAccessKeyId);
return false;
}
if (bkt.acl == "FULL_CONTROL" ||
(bkt.acl == "READ" && flags() & kFlagsRead) ||
(bkt.acl == "WRITE" && flags() & kFlagsWrite)) {
if (bkt.acl == "FULL_CONTROL" || bkt.acl == "READ") {
user_name_.assign(bkt.owner);
return true;
}
Expand Down

0 comments on commit 59354b3

Please sign in to comment.