Skip to content

Commit

Permalink
修改 policy demo
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Mar 26, 2018
1 parent 76cb31f commit d6e6547
Showing 1 changed file with 48 additions and 10 deletions.
58 changes: 48 additions & 10 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,54 @@ function putBucketPolicy() {
{
"effect": "allow",
"action": [
"name/cos:GetBucket",
"name/cos:PutObject",
"name/cos:PostObject",
"name/cos:PutObjectCopy",
"name/cos:InitiateMultipartUpload",
"name/cos:UploadPart",
"name/cos:UploadPartCopy",
"name/cos:CompleteMultipartUpload",
"name/cos:AbortMultipartUpload",
"name/cos:AppendObject"
// 这里可以从临时密钥的权限上控制前端允许的操作
// 'name/cos:*', // 这样写可以包含下面所有权限

// // 列出所有允许的操作
// // ACL 读写
// 'name/cos:GetBucketACL',
// 'name/cos:PutBucketACL',
// 'name/cos:GetObjectACL',
// 'name/cos:PutObjectACL',
// // 简单 Bucket 操作
// 'name/cos:PutBucket',
// 'name/cos:HeadBucket',
// 'name/cos:GetBucket',
// 'name/cos:DeleteBucket',
// 'name/cos:GetBucketLocation',
// // Versioning
// 'name/cos:PutBucketVersioning',
// 'name/cos:GetBucketVersioning',
// // CORS
// 'name/cos:PutBucketCORS',
// 'name/cos:GetBucketCORS',
// 'name/cos:DeleteBucketCORS',
// // Lifecycle
// 'name/cos:PutBucketLifecycle',
// 'name/cos:GetBucketLifecycle',
// 'name/cos:DeleteBucketLifecycle',
// // Replication
// 'name/cos:PutBucketReplication',
// 'name/cos:GetBucketReplication',
// 'name/cos:DeleteBucketReplication',
// // 删除文件
// 'name/cos:DeleteMultipleObject',
// 'name/cos:DeleteObject',
// 简单文件操作
'name/cos:PutObject',
'name/cos:AppendObject',
'name/cos:GetObject',
'name/cos:HeadObject',
'name/cos:OptionsObject',
'name/cos:PutObjectCopy',
'name/cos:PostObjectRestore',
// 分片上传操作
'name/cos:InitiateMultipartUpload',
'name/cos:ListMultipartUploads',
'name/cos:ListParts',
'name/cos:UploadPart',
'name/cos:CompleteMultipartUpload',
'name/cos:AbortMultipartUpload',
],
// "resource": ["qcs::cos:ap-guangzhou:uid/1250000000:test-1250000000/*"] // 1250000000 是 appid
"resource": ["qcs::cos:" + config.Region + ":uid/" + AppId + ":" + config.Bucket + "/*"] // 1250000000 是 appid
Expand Down

0 comments on commit d6e6547

Please sign in to comment.