Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Minio Dart
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
images
Minio Dart
Commits
050e6ba5
Commit
050e6ba5
authored
4 years ago
by
Adrian Cybulski
Browse files
Options
Downloads
Patches
Plain Diff
Query object's ACL
- Object's ACL Query - Include object's ACL in stat
parent
acb48ef4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/src/minio.dart
+21
-0
21 additions, 0 deletions
lib/src/minio.dart
lib/src/minio_models.dart
+4
-0
4 additions, 0 deletions
lib/src/minio_models.dart
test/minio_dart_test.dart
+30
-0
30 additions, 0 deletions
test/minio_dart_test.dart
with
55 additions
and
0 deletions
lib/src/minio.dart
+
21
−
0
View file @
050e6ba5
...
...
@@ -11,6 +11,10 @@ import 'package:minio/src/minio_uploader.dart';
import
'package:minio/src/utils.dart'
;
import
'package:xml/xml.dart'
as
xml
;
import
'../models.dart'
;
import
'../models.dart'
;
import
'minio_helpers.dart'
;
class
Minio
{
/// Initializes a new client object.
Minio
({
...
...
@@ -981,6 +985,22 @@ class Minio {
validate
(
resp
,
expect:
204
);
}
Future
<
AccessControlPolicy
>
getObjectACL
(
String
bucket
,
String
object
)
async
{
MinioInvalidBucketNameError
.
check
(
bucket
);
MinioInvalidObjectNameError
.
check
(
object
);
final
resp
=
await
_client
.
request
(
method:
'GET'
,
bucket:
bucket
,
object:
object
,
queries:
{
"acl"
:
""
},
);
return
AccessControlPolicy
.
fromXml
(
xml
.
XmlDocument
.
parse
(
resp
.
body
)
.
firstChild
,
);
}
/// Stat information of the object.
Future
<
StatObjectResult
>
statObject
(
String
bucket
,
String
object
)
async
{
MinioInvalidBucketNameError
.
check
(
bucket
);
...
...
@@ -1004,6 +1024,7 @@ class Minio {
size:
int
.
parse
(
resp
.
headers
[
'content-length'
]),
metaData:
extractMetadata
(
resp
.
headers
),
lastModified:
parseRfc7231Time
(
resp
.
headers
[
'last-modified'
]),
acl:
await
getObjectACL
(
bucket
,
object
),
);
}
}
This diff is collapsed.
Click to expand it.
lib/src/minio_models.dart
+
4
−
0
View file @
050e6ba5
...
...
@@ -2,6 +2,8 @@ import 'package:minio/models.dart';
import
'package:minio/src/minio_errors.dart'
;
import
'package:xml/xml.dart'
;
import
'../models.dart'
;
class
ListObjectsChunk
{
List
<
Object
>
objects
;
List
<
String
>
prefixes
;
...
...
@@ -106,12 +108,14 @@ class StatObjectResult {
this
.
etag
,
this
.
lastModified
,
this
.
metaData
,
this
.
acl
,
});
final
int
size
;
final
String
etag
;
final
DateTime
lastModified
;
final
Map
<
String
,
String
>
metaData
;
final
AccessControlPolicy
acl
;
}
/// Build PostPolicy object that can be signed by presignedPostPolicy
...
...
This diff is collapsed.
Click to expand it.
test/minio_dart_test.dart
+
30
−
0
View file @
050e6ba5
...
...
@@ -96,6 +96,36 @@ void main() {
});
});
group
(
'getObjectACL'
,
()
{
final
bucketName
=
DateTime
.
now
()
.
millisecondsSinceEpoch
.
toString
();
Directory
tempDir
;
File
testFile
;
final
objectName
=
'a.jpg'
;
setUpAll
(()
async
{
tempDir
=
await
Directory
.
systemTemp
.
createTemp
();
testFile
=
await
File
(
'
${tempDir.path}
/
$objectName
'
)
.
create
();
await
testFile
.
writeAsString
(
'random bytes'
);
final
minio
=
_getClient
();
await
minio
.
makeBucket
(
bucketName
);
await
minio
.
fPutObject
(
bucketName
,
objectName
,
testFile
.
path
);
});
tearDownAll
(()
async
{
await
tempDir
.
delete
(
recursive:
true
);
});
test
(
'getObjectACL() fetch objects acl'
,
()
async
{
final
minio
=
_getClient
();
var
acl
=
await
minio
.
getObjectACL
(
bucketName
,
objectName
);
});
},
);
group
(
'fPutObject'
,
()
{
final
bucketName
=
DateTime
.
now
()
.
millisecondsSinceEpoch
.
toString
();
Directory
tempDir
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment