281 Posts

June 18th, 2012 07:00

What utility are you using to upload with?  Are you using the namespace?  By default, objects created are given the ACL (creator)=FULL_CONTROL and nothing else.  This also applies to any directories created implicitly or otherwise.  So, if another token created the object and/or directories, you won't have access to them unless you change the ACL.

1 Rookie

 • 

4 Posts

June 18th, 2012 07:00

I'm using Java api.

Yes, I'm using namespace.

Sorry, but in that case how other user can upload or download files using his own tokens.

Thanks a lot.

281 Posts

June 18th, 2012 08:00

If you wish to share data between tokens, you should either add public access to the object's ACL and/or the other UIDs.  For example, when you create an object, you can set the public read ACL like this:

              ObjectPath path = new ObjectPath("/path/to/file.txt");

        Acl acl = new Acl();

        acl.addGrant( new Grant( new Grantee( uid, Grantee.GRANT_TYPE.USER ), Permission.FULL_CONTROL ) );

        acl.addGrant( new Grant( Grantee.OTHER, Permission.READ ) );

        ObjectId id = this.esu.createObjectOnPath(path, acl, null, null, "text/plain" );

Note that "uid" above is the last part of your token.  If your token is abcd123.../test2, "uid" should only be "test2".  In the above example, you will also need to either manually create the directories /path/ and /path/to/ or update their ACL after creating /path/to/file.txt.

No Events found!

Top