Start a new topic

unable to add global read write and reader/writer list to _acl

 I am using latest android stable Version 2.10.1 - Aug 5, 2015.


I am able to save an object but I also want to add global read write and reader/writer list as follow:


        ArrayList<String> writers = new ArrayList<String>();
        writers.add("55c2a76cdf52155a6900fcuf");

        KinveyMetaData.AccessControlList acl = new KinveyMetaData.AccessControlList();
        acl.setGloballyReadable(false);
        acl.setGloballyWriteable(false);
        acl.setWrite(writers);
        acl.setRead(writers);

        visitor.setAcl(acl);

        AppController.getInstance().getKinveyClient().appData("visitor", Visitor.class).save(visitor, new KinveyClientCallback<Visitor>() {
            @Override
            public void onSuccess(Visitor result) {

            }

});


 

but the column _acl only showing


{"creator":"55a0795bea1237bf7100a999"}


I also tried in javascript and it is able to add:

var acl = new Kinvey.Acl(member);
acl.setGloballyReadable(false);// Make the model readable to all users.
acl.setGloballyWritable(false);// Make the model writable for all users.
acl.addReader('55c2a76cdf52155a6900fcef');
acl.addWriter('55c2a76cdf52155a6900fcef');                               

Kinvey.DataStore.save('visitor', visitor).then(function() {
             
}, function(error) {

});       

 

and result is what I expected:


{"gr":false,"gw":false,"r":["55c2a76cdf52155a6900fcef"],"w":["55c2a76cdf52155a6900fcef"],"creator":"55a0795bea1237bf7100a93f"}


so what is wrong with android sdk?







yes definitely save successfully else I won't be able to see the row in kinvey console.

definitely logged in before executed saving of a visitor.


I have solved the problem by setting group read/write and user read/write using business logic

Hi Mark,


I tried to reproduce this issue with the same library version and your code. But, I was unable to reproduce the issue.


Please find my piece of code below:    

        Visitor visitor = new Visitor("kinvey");
        ArrayList<String> writers = new ArrayList<String>();
        writers.add("55c8a3c6e0bc99fd3102b02e");
        KinveyMetaData.AccessControlList acl = new KinveyMetaData.AccessControlList();
        acl.setGloballyReadable(false);
        acl.setGloballyWriteable(false);
        acl.setWrite(writers);
        acl.setRead(writers);

        visitor.setAcl(acl);
        mKinveyClient.appData("visitor", Visitor.class).save(visitor, new KinveyClientCallback<Visitor>() {
            @Override
            public void onSuccess(Visitor result) {
                Log.d("TAG", result.getAcl().toString());
            }

            @Override
            public void onFailure(Throwable throwable) {
                Log.d("TAG", "Error - " + throwable);
            }

        }); 

   

Can you confirm a couple of things:

  1. Is your save call successful? If not, can you share the error thrown by onFailure method?
  2. Is a valid user logged in before this piece of code is executed?


Regards,
Wani
Login or Signup to post a comment