Set Access Controls

You can set the access control on buckets, objects and topics in a thing scope (See Thing scope for the overview of the thing scope).

The way you set the access control on a thing scope's buckets, objects and topics is the same as that of other scopes. See Setting a Bucket's ACL, Setting a KiiObject's ACL and Setting a Topic's ACL to learn more.

Here are examples of setting a new ACL on a thing scope bucket.

Android

  • try {
      // Instantiate a thing by vendor thing ID.
      KiiThing thing = KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS");
    
      // Create the thing's bucket.
      KiiBucket thingBucket = thing.bucket("thing_bucket");
    
      // Instantiate the bucket's ACL.
      KiiACL thAcl = thingBucket.acl();
    
      // Set ACL entries to the bucket's ACL.
      thAcl.putACLEntry(new KiiACLEntry(KiiAnyAuthenticatedUser.create(),
              BucketAction.QUERY_OBJECTS_IN_BUCKET, true));
      thAcl.putACLEntry(new KiiACLEntry(KiiAnyAuthenticatedUser.create(),
              BucketAction.CREATE_OBJECTS_IN_BUCKET, true));
    
      // Save the ACL to the server.
      thAcl.save();
    } catch (AppException e) {
      // Handle the error.
    } catch (IOException e) {
      // Handle the error.
    } catch (ACLOperationException e) {
      // Handle the error.
    }
  • // Instantiate a thing by vendor thing ID.
    KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS", new KiiCallback<KiiThing>() {
      @Override
      public void onComplete(KiiThing result, Exception e) {
        if (e != null) {
          // Handle the error.
          return;
        }
    
        // Create the thing's bucket.
        KiiBucket thingBucket = result.bucket("thing_bucket");
    
        // Instantiate the bucket's ACL.
        KiiACL thAcl = thingBucket.acl();
    
        // Set ACL entries to the bucket's ACL.
        thAcl.putACLEntry(new KiiACLEntry(KiiAnyAuthenticatedUser.create(),
                BucketAction.QUERY_OBJECTS_IN_BUCKET, true));
        thAcl.putACLEntry(new KiiACLEntry(KiiAnyAuthenticatedUser.create(),
                BucketAction.CREATE_OBJECTS_IN_BUCKET, true));
    
        // Save the ACL to the server.
        thAcl.save(new KiiACLCallBack() {
          @Override
          public void onSaveCompleted(int token, KiiACL acl, Exception exception) {
            if (exception != null) {
              // Handle the error.
              return;
            }
          }
        });
      }
    });

iOS

Swift:

  • let thing : KiiThing
    
    do{
      // Instantiate a thing by vendor thing ID.
      thing = try KiiThing.loadSynchronous(withVendorThingID: "rBnvSPOXBDF9r29GJeGS")
    }catch(let error as NSError){
      // Handle the error.
      return
    }
    
    // Create the thing's bucket.
    let thingBucket = thing.bucket(withName: "thing_bucket")
    
    var success: NSArray?
    var failed: NSArray?
    
    // Instantiate the bucket's ACL.
    let acl = thingBucket.bucketACL
    
    // Set ACL entries to the bucket's ACL.
    acl.put(KiiACLEntry(subject: KiiAnyAuthenticatedUser.aclSubject(), andAction: KiiACLAction.bucketActionQueryObjects)!)
    acl.put(KiiACLEntry(subject: KiiAnyAuthenticatedUser.aclSubject(), andAction: KiiACLAction.bucketActionCreateObjects)!)
    
    do {
      // Save the ACL to the server.
      try acl.saveSynchronous(&success, didFail: &failed)
    } catch let error as NSError {
      // Handle the error.
      return
    }
  • // Instantiate a thing by vendor thing ID.
    KiiThing.load(withVendorThingID: "rBnvSPOXBDF9r29GJeGS") { (thing , error) -> Void in
      if error != nil {
        // Handle the error.
        return
      }
    
      // Create the thing's bucket.
      let thingBucket = thing!.bucket(withName: "thing_bucket")
    
      // Instantiate the bucket's ACL.
      let acl = thingBucket.bucketACL
    
      // Set ACL entries to the bucket's ACL.
      acl.put(KiiACLEntry(subject: KiiAnyAuthenticatedUser.aclSubject(), andAction: KiiACLAction.bucketActionQueryObjects)!)
      acl.put(KiiACLEntry(subject: KiiAnyAuthenticatedUser.aclSubject(), andAction: KiiACLAction.bucketActionCreateObjects)!)
    
      // Save the ACL to the server.
      acl.save { (acl : KiiACL?, succeeded : [Any]?, failed : [Any]?, error : Error?) -> Void in
        if (error != nil) {
          // Handle the error.
          return
        }
      }
    }

Objective-C:

  • NSError* error = nil;
    
    // Instantiate a thing by vendor thing ID.
    KiiThing* thing = [KiiThing loadSynchronousWithVendorThingID:@"rBnvSPOXBDF9r29GJeGS"
                                                           error:&error];
    if (error != nil) {
      // Handle the error.
      return;
    }
    
    // Create the thing's bucket.
    KiiBucket* thingBucket = [thing bucketWithName:@"thing_bucket"];
    
    NSArray* success = nil;
    NSArray* failed = nil;
    
    // Instantiate the bucket's ACL.
    KiiACL* acl = [thingBucket bucketACL];
    
    // Set ACL entries to the bucket's ACL.
    [acl putACLEntry:[KiiACLEntry entryWithSubject:[[KiiAnonymousUser alloc] init]
                                         andAction:KiiACLBucketActionQueryObjects]
    ];
    [acl putACLEntry:[KiiACLEntry entryWithSubject:[[KiiAnyAuthenticatedUser alloc] init]
                                         andAction:KiiACLBucketActionCreateObjects]
    ];
    
    // Save the ACL to the server.
    [acl saveSynchronous:&error
              didSucceed:&success
                 didFail:&failed];
    if (error != nil) {
      // Handle the error.
      return;
    }
  • // Instantiate a thing by vendor thing ID.
    [KiiThing loadWithVendorThingID:@"rBnvSPOXBDF9r29GJeGS"
                              block:^(KiiThing *thing, NSError *error) {
      if (error != nil) {
        // Handle the error.
        return;
      }
    
      // Create the thing's bucket.
      KiiBucket* thingBucket = [thing bucketWithName:@"thing_bucket"];
    
      // Instantiate the bucket's ACL.
      KiiACL* acl = [thingBucket bucketACL];
    
      // Set ACL entries to the bucket's ACL.
      [acl putACLEntry:[KiiACLEntry entryWithSubject:[[KiiAnonymousUser alloc] init]
                                           andAction:KiiACLBucketActionQueryObjects]
      ];
      [acl putACLEntry:[KiiACLEntry entryWithSubject:[[KiiAnyAuthenticatedUser alloc] init]
                                           andAction:KiiACLBucketActionCreateObjects]
      ];
    
      // Save the ACL to the server.
      [acl saveWithBlock:^(KiiACL *acl, NSArray *succeeded, NSArray *failed, NSError *error) {
        if (error != nil) {
          // Handle the error.
          return;
        }
      }];
    }];

JavaScript

// Instantiate a thing by vendor thing ID.
KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS", {
  success: function(thing) {
    // Create the thing's bucket.
    var thingBucket = thing.bucketWithName("thing_bucket");

    // Instantiate the bucket's ACL.
    var thACL = thingBucket.acl();

    // Create ACL entries.
    var entry1 = KiiACLEntry.entryWithSubject(new KiiAnyAuthenticatedUser(), KiiACLAction.KiiACLBucketActionQueryObjects);
    thACL.putACLEntry(entry1);
    var entry2 = KiiACLEntry.entryWithSubject(new KiiAnyAuthenticatedUser(), KiiACLAction.KiiACLBucketActionCreateObjects);

    // Set the ACL entries to the bucket's ACL.
    theACL.putACLEntry(entry2);

    // Save the ACL to the server.
    thACL.save({
      success: function(acl) {
        // Do something.
      },
      failure: function(acl, error) {
        // Handle the error.
      }
    });
  },
  failure: function(error) {
    // Handle the error.
  }
});

The next examples show how to set a new ACL on a thing scope object.

Android

  • try {
      // Instantiate a thing by vendor thing ID.
      KiiThing thing = KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS");
    
      // Create the thing's bucket.
      KiiBucket thingBucket = thing.bucket("thing_bucket");
    
      // Create a KiiObject.
      KiiObject object = thingBucket.object();
    
      // Set a key-value pair.
      object.set("geo", new GeoPoint(35710036.0, 139811046.0));
    
      // Save the KiiObject.
      object.save();
    
      // Instantiate the KiiObject's ACL.
      KiiACL acl = object.acl();
    
      // Set an ACL entry to the KiiObject's ACL.
      acl.putACLEntry(new KiiACLEntry(KiiAnonymousUser.create(),
              ObjectAction.READ_EXISTING_OBJECT, true));
    
      // Save the ACL to the server.
      acl.save();
    } catch (AppException e) {
      // Handle the error.
    } catch (IOException e) {
      // Handle the error.
    } catch (ACLOperationException e) {
      // Handle the error.
    }
  • // Instantiate a thing by vendor thing ID.
    KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS", new KiiCallback<KiiThing>() {
      @Override
      public void onComplete(KiiThing result, Exception e) {
        if (e != null) {
          // Handle the error.
          return;
        }
    
        // Create the thing's bucket.
        KiiBucket thingBucket = result.bucket("thing_bucket");
    
        // Create a KiiObject.
        KiiObject object = thingBucket.object();
    
        // Set a key-value pair.
        object.set("geo", new GeoPoint(35710036.0, 139811046.0));
    
        // Save the KiiObject.
        object.save(new KiiObjectCallBack() {
          @Override
          public void onSaveCompleted(int token, KiiObject object, Exception exception) {
            if (exception != null) {
              // Handle the error.
              return;
            }
    
            // Instantiate the KiiObject's ACL.
            KiiACL acl = object.acl();
    
            // Set an ACL entry to the KiiObject's ACL.
            acl.putACLEntry(new KiiACLEntry(KiiAnonymousUser.create(),
                    ObjectAction.READ_EXISTING_OBJECT, true));
    
            // Save the ACL to the server.
            acl.save(new KiiACLCallBack() {
              @Override
              public void onSaveCompleted(int token, KiiACL acl, Exception exception) {
                if (exception != null) {
                  // Handle the error.
                  return;
                }
              }
            });
          }
        });
      }
    });

iOS

Swift:

  • let thing : KiiThing
    
    do{
      // Instantiate a thing by vendor thing ID.
      thing = try KiiThing.loadSynchronous(withVendorThingID: "rBnvSPOXBDF9r29GJeGS")
    }catch(let error as NSError){
      // Handle the error.
      return
    }
    
    // Create the thing's bucket.
    let thingBucket = thing.bucket(withName: "thing_bucket")
    
    // Create a KiiObject.
    let object = thingBucket.createObject()
    
    // Set a key-value pair.
    object.setGeoPoint(KiiGeoPoint(latitude: 35.710036, andLongitude: 139.811046), forKey: "geo")
    
    do {
      // Save the KiiObject.
      try object.saveSynchronous()
    } catch let error as NSError {
      // Handle the error.
      return
    }
    
    // Instantiate the KiiObject's ACL.
    let acl = object.objectACL
    
    // Set an ACL entry to the KiiObject's ACL.
    acl.put(KiiACLEntry(subject: KiiAnyAuthenticatedUser.aclSubject(), andAction: KiiACLAction.objectActionRead)!)
    
    var succeeded: NSArray?
    var failed: NSArray?
    
    do {
      // Save the ACL to the server.
      try acl.saveSynchronous(&succeeded, didFail: &failed)
    } catch let error as NSError {
      // Handle the error.
      return
    }
  • // Instantiate a thing by vendor thing ID.
    KiiThing.load(withVendorThingID: "rBnvSPOXBDF9r29GJeGS") { (thing , error) -> Void in
      if error != nil {
        // Handle the error.
        return
      }
    
      // Create the thing's bucket.
      let thingBucket = thing!.bucket(withName: "thing_bucket")
    
      // Create a KiiObject.
      let object = thingBucket.createObject()
    
      // Set a key-value pair.
      object.setGeoPoint(KiiGeoPoint(latitude: 35.710036, andLongitude: 139.811046), forKey: "geo")
    
      // Save the KiiObject.
      object.save({ (object : KiiObject?, error : Error?) -> Void in
        if error != nil {
          // Handle the error.
          return
        }
    
        // Instantiate the KiiObject's ACL.
        let acl = object!.objectACL
    
        // Set an ACL entry to the KiiObject's ACL.
        acl.put(KiiACLEntry(subject: KiiAnyAuthenticatedUser.aclSubject(), andAction: KiiACLAction.objectActionRead)!)
    
        // Save the ACL to the server.
        acl.save { (acl : KiiACL?, succeeded : [Any]?, failed : [Any]?, error : Error?) -> Void in
          if (error != nil) {
            // Handle the error.
            return
          }
        }
      })
    }

Objective-C:

  • NSError* error = nil;
    
    // Instantiate a thing by vendor thing ID.
    KiiThing* thing = [KiiThing loadSynchronousWithVendorThingID:@"rBnvSPOXBDF9r29GJeGS"
                                                           error:&error];
    if (error != nil) {
      // Handle the error.
      return;
    }
    
    // Create the thing's bucket.
    KiiBucket* thingBucket = [thing bucketWithName:@"thing_bucket"];
    
    // Create a KiiObject.
    KiiObject* obj = [thingBucket createObject];
    
    // Set a key-value pair.
    [obj setGeoPoint:[[KiiGeoPoint alloc] initWithLatitude:35710036.0
                                              andLongitude:139811046.0]
              forKey:@"geo"];
    
    // Save the KiiObject.
    [obj saveSynchronous:&error];
    if (error != nil) {
      // Handle the error.
      return;
    }
    
    // Instantiate the KiiObject's ACL.
    KiiACL* acl = [obj objectACL];
    
    // Set an ACL entry to the KiiObject's ACL.
    [acl putACLEntry:[KiiACLEntry entryWithSubject:[[KiiAnonymousUser alloc] init]
                                         andAction:KiiACLObjectActionRead]
    ];
    
    NSArray* success = nil;
    NSArray* failed = nil;
    
    // Save the ACL to the server.
    [acl saveSynchronous:&error
              didSucceed:&success
                 didFail:&failed];
    if (error != nil) {
      // Handle the error.
      return;
    }
  • // Instantiate a thing by vendor thing ID.
    [KiiThing loadWithVendorThingID:@"rBnvSPOXBDF9r29GJeGS"
                              block:^(KiiThing *thing, NSError *error) {
      if (error != nil) {
        // Handle the error.
        return;
      }
    
      // Create the thing's bucket.
      KiiBucket* bucket = [thing bucketWithName:@"thing_bucket"];
    
      // Create a KiiObject.
      KiiObject* obj = [bucket createObject];
    
      // Set a key-value pair.
      [obj setGeoPoint:[[KiiGeoPoint alloc] initWithLatitude:35710036.0
                                                andLongitude:139811046.0]
                forKey:@"geo"];
    
      // Save the KiiObject.
      [obj save:YES withBlock:^(KiiObject *object, NSError *error) {
        if (error != nil) {
          // Handle the error.
          return;
        }
    
        // Instantiate the KiiObject's ACL.
        KiiACL* acl = [object objectACL];
    
        // Set an ACL entry to the KiiObject's ACL.
        [acl putACLEntry:[KiiACLEntry entryWithSubject:[[KiiAnonymousUser alloc] init]
                                             andAction:KiiACLObjectActionRead]
        ];
    
        // Save the ACL to the server.
        [acl saveWithBlock:^(KiiACL *acl, NSArray *succeeded, NSArray *failed, NSError *error) {
          if (error != nil) {
            // Handle the error.
            return;
          }
        }];
      }];
    }];

JavaScript

// Instantiate a thing by vendor thing ID.
KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS", {
  success: function(thing) {
    // Create the thing's bucket.
    var thingBucket = thing.bucketWithName("thing_bucket");

    // Create a KiiObject.
    var object = thingBucket.createObject();

    // Set a key-value pair.
    object.set("geo", KiiGeoPoint.geoPoint(35710036.0, 139811046.0));

    // Save the KiiObject.
    object.save({
      success: function(theObject) {
        // Instantiate the KiiObject's ACL.
        var acl = object.objectACL();

        // Create an ACL entry.
        var aclEntry = KiiACLEntry.entryWithSubject(new KiiAnonymousUser(), KiiACLAction.KiiACLObjectActionRead);

        // Set the ACL entry to the KiiObject's ACL.
        acl.putACLEntry(aclEntry);

        // Save the ACL to the server.
        acl.save({
          success: function(theACL) {
            // Do something.
          },
          failure: function(theACL, error) {
            // Handle the error.
          }
        });
      },
      failure: function(theObject, error) {
        // Handle the error.
      }
    });
  },
  failure: function(error) {
    // Handle the error.
  }
});

The next examples show how to set a new ACL on a thing scope topic.

Android

  • try {
      // Instantiate a thing by vendor thing ID.
      KiiThing thing = KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS");
    
      // Create a topic in the thing scope.
      KiiTopic thingTopic = thing.topic("thing_topic");
    
      // Save the topic to Kii Cloud.
      topic.save();
    
      // Instantiate the topic's ACL.
      KiiACL thAcl = thingTopic.acl();
    
      // Set an ACL entry to the topic's ACL.
      thAcl.putACLEntry(new KiiACLEntry(KiiAnyAuthenticatedUser.create(),
              TopicAction.SUBSCRIBE_TO_TOPIC, true));
    
      // Save the ACL to the server.
      thAcl.save();
    } catch (AppException e) {
      // Handle the error.
    } catch (IOException e) {
      // Handle the error.
    } catch (ACLOperationException e) {
      // Handle the error.
    }
  • // Instantiate a thing by vendor thing ID.
    KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS", new KiiCallback<KiiThing>() {
      @Override
      public void onComplete(KiiThing result, Exception e) {
        if (e != null) {
          // Handle the error.
          return;
        }
    
        // Create a topic in the thing scope.
        KiiTopic thingTopic = result.topic("thing_topic");
    
        // Save the topic to Kii Cloud.
        thingTopic.save(new KiiTopicCallBack() {
          @Override
          public void onSaveCompleted(int taskId, KiiTopic target, Exception exception) {
            if (exception != null) {
              // Handle the error.
              return;
            }
    
            // Instantiate the topic's ACL.
            KiiACL thAcl = thingTopic.acl();
    
            // Set an ACL entry to the topic's ACL.
            thAcl.putACLEntry(new KiiACLEntry(KiiAnyAuthenticatedUser.create(),
                    TopicAction.SUBSCRIBE_TO_TOPIC, true));
    
            // Save the ACL to the server.
            thAcl.save(new KiiACLCallBack() {
              @Override
              public void onSaveCompleted(int token, KiiACL acl, Exception exception) {
                if (exception != null) {
                  // Handle the error.
                  return;
                }
              }
            });
          }
        });
      }
    });

iOS

Swift:

  • var success: NSArray?
    var failed: NSArray?
    let thing : KiiThing
    
    do{
      // Instantiate a thing by vendor thing ID.
      thing = try KiiThing.loadSynchronous(withVendorThingID: "rBnvSPOXBDF9r29GJeGS")
    }catch(let error as NSError){
      // Handle the error.
      return
    }
    
    // Create a topic in the thing scope.
    let thingTopic = thing.topic(withName: "thing_topic")
    
    do {
      // Save the topic to Kii Cloud.
      try thingTopic.saveSynchronous()
    } catch let error as NSError {
      // Handle the error.
      return
    }
    
    // Instantiate the topic's ACL.
    let acl = thingTopic.topicACL
    
    // Set an ACL entry to the topic's ACL.
    acl.put(KiiACLEntry(subject: KiiAnyAuthenticatedUser.aclSubject(), andAction: KiiACLAction.topicActionSubscribe)!)
    
    do {
      // Save the ACL to the server.
      try acl.saveSynchronous(&success, didFail: &failed)
    } catch let error as NSError {
      // Handle the error.
      return
    }
  • // Instantiate a thing by vendor thing ID.
    KiiThing.load(withVendorThingID: "rBnvSPOXBDF9r29GJeGS") { (thing , error) -> Void in
      if error != nil {
        // Handle the error.
        return
      }
    
      // Create a topic in the thing scope.
      let thingTopic = thing!.topic(withName: "thing_topic")
    
      // Save the topic to Kii Cloud.
      thingTopic.save({ (thingTopic , error : Error?) -> Void in
        if error != nil {
          // Handle the error.
          return
        }
    
        // Instantiate the topic's ACL.
        let acl = thingTopic.topicACL
    
        // Set an ACL entry to the topic's ACL.
        acl.put(KiiACLEntry(subject: KiiAnyAuthenticatedUser.aclSubject(), andAction: KiiACLAction.topicActionSubscribe)!)
    
        // Save the ACL to the server.
        acl.save({ (acl : KiiACL?, succeeded : [Any]?, failed : [Any]?, error : Error?) -> Void in
          if (error != nil) {
            // Handle the error.
            return
          }
        })
      })
    }

Objective-C:

  • NSError* error = nil;
    NSArray* success = nil;
    NSArray* failed = nil;
    
    // Instantiate a thing by vendor thing ID.
    KiiThing* thing = [KiiThing loadSynchronousWithVendorThingID:@"rBnvSPOXBDF9r29GJeGS"
                                                           error:&error];
    if (error != nil) {
      // Handle the error.
      return;
    }
    
    // Create a topic in the thing scope.
    KiiTopic* thingTopic= [thing topicWithName:@"thing_topic"];
    
    // Save the topic to Kii Cloud.
    [thingTopic saveSynchronous:&error];
    if (error != nil) {
      // Handle the error.
      return;
    }
    
    // Instantiate the topic's ACL.
    KiiACL* acl = [thingTopic topicACL];
    
    // Set an ACL entry to the topic's ACL.
    [acl putACLEntry:[KiiACLEntry entryWithSubject:[[KiiAnonymousUser alloc] init]
                                         andAction:KiiACLTopicActionSubscribe]
    ];
    
    // Save the ACL to the server.
    [acl saveSynchronous:&error
              didSucceed:&success
                 didFail:&failed];
    if (error != nil) {
      // Handle the error.
      return;
    }
  • // Instantiate a thing by vendor thing ID.
    [KiiThing loadWithVendorThingID:@"rBnvSPOXBDF9r29GJeGS"
                              block:^(KiiThing *thing, NSError *error) {
      if (error != nil) {
        // Handle the error.
        return;
      }
    
      // Create a topic in the thing scope.
      KiiTopic* thingTopic= [thing topicWithName:@"thing_topic"];
    
      // Save the topic to Kii Cloud.
      [thingTopic saveWithBlock:^(KiiTopic *topic, NSError *error) {
        if (error != nil) {
          // Handle the error.
          return;
        }
    
        // Instantiate the topic's ACL.
        KiiACL* acl = [thingTopic topicACL];
    
        // Set an ACL entry to the topic's ACL.
        [acl putACLEntry:[KiiACLEntry entryWithSubject:[[KiiAnonymousUser alloc] init]
                                             andAction:KiiACLTopicActionSubscribe]
        ];
    
        // Save the ACL to the server.
        [acl saveWithBlock:^(KiiACL *acl, NSArray *succeeded, NSArray *failed, NSError *error) {
          if (error != nil) {
            // Handle the error.
            return;
          }
        }];
      }];
    }];

JavaScript

// Instantiate a thing by vendor thing ID.
KiiThing.loadWithVendorThingID("rBnvSPOXBDF9r29GJeGS", {
  success: function(thing) {
    // Create a topic in the thing scope.
    var thingTopic = thing.topicWithName("thing_topic");

    // Save the topic to Kii Cloud.
    topic.save({
      success: function(theTopic) {

        // Instantiate the topic's ACL.
        var thACL = thingTopic.acl();

        // Create an ACL entry.
        var aclEntry = KiiACLEntry.entryWithSubject(new KiiAnyAuthenticatedUser(), KiiACLAction.KiiACLSubscribeToTopic);

        // Set the ACL entry to the topic's ACL.
        thACL.putACLEntry(aclEntry);

        // Save the ACL to the server.
        thACL.save({
          success: function(acl) {
            // Do something.
          },
          failure: function(acl, error) {
            // Handle the error.
          }
        });
      },
      failure: function(error) {
        // Handle the error.
      }
    });
  },
  failure: function(error) {
    // Handle the error.
  }
});