Beispiel #1
0
        private void ExecListAclEntries(KiiHttpClientFactory factory, KiiACLListCallback <T, U> callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("KiiACLListCallback must not be null");
            }
            try
            {
                Utils.CheckInitialize(true);
            }
            catch (Exception e)
            {
                callback(null, e);
                return;
            }
            string id = ParentID;

            if (Utils.IsEmpty(id))
            {
                callback(null, new InvalidOperationException("Topic does not exist in the cloud."));
                return;
            }
            // Fetch ACL
            string aclUrl = Utils.Path(ParentUrl, "acl");

            KiiHttpClient client = factory.Create(aclUrl, Kii.AppId, Kii.AppKey, KiiHttpMethod.GET);

            KiiCloudEngine.SetAuthBearer(client);

            // send request
            client.SendRequest((ApiResponse response, Exception e) =>
            {
                if (e != null)
                {
                    callback(null, e);
                    return;
                }
                // parse response
                IList <KiiACLEntry <T, U> > list = null;
                try
                {
                    JsonObject respObj = new JsonObject(response.Body);
                    list = ParseListResponse(respObj);
                }
                catch (JsonException)
                {
                    callback(null, new IllegalKiiBaseObjectFormatException(response.Body));
                    return;
                }
                callback(list, null);
            });
        }
Beispiel #2
0
 /// <summary>
 /// Lists the acl entries of this bucket
 /// </summary>
 /// <returns>
 /// The list of acl entries.
 /// </returns>
 /// <param name='callback'>
 /// Callback.
 /// </param>
 public void ListAclEntries(KiiACLListCallback <KiiBucket, BucketAction> callback)
 {
     new KiiBucketAcl(this).ListAclEntries(callback);
 }
Beispiel #3
0
 /// <summary>
 /// Asynchronous call for <see cref="ListAclEntries()"/>.
 /// </summary>
 /// <returns>
 /// The list of acl entries.
 /// </returns>
 /// <param name='callback'>
 /// Callback.
 /// </param>
 /// <remarks>
 /// This api sends a request to server.
 /// </remarks>
 public void ListAclEntries(KiiACLListCallback <KiiTopic, TopicAction> callback)
 {
     new KiiTopicACL(this).ListAclEntries(callback);
 }
Beispiel #4
0
 /// <summary>
 /// Gets the current ACL entries
 /// </summary>
 /// <remarks>
 /// This API access to server and fetch all list of User/Group and granted actions.
 /// </remarks>
 /// <returns>
 /// The acl entries.
 /// </returns>
 /// <param name='callback'>
 /// Callback.
 /// </param>
 /// <exception cref='T:ACLOperationException'>
 /// Is thrown when the ACL operation is failed.
 /// </exception>
 /// <exception cref='IllegalKiiBaseObjectFormatException'>
 /// Is thrown when server sends broken Json.
 /// </exception>
 internal void ListAclEntries(KiiACLListCallback <T, U> callback)
 {
     ExecListAclEntries(Kii.AsyncHttpClientFactory, callback);
 }