Exemplo n.º 1
0
        private void ExecSave(ACLOperation operation, KiiHttpClientFactory factory, KiiACLCallback <T, U> callback)
        {
            mParent.SaveParentIfNeeds();
            string requestUrl = Utils.Path(mParent.ParentUrl, "acl", mParent.ActionString, mSubject.Subject);

            KiiHttpClient client = GetHttpClient(factory, requestUrl, operation);

            if (client == null)
            {
                if (callback != null)
                {
                    callback(null, new InvalidOperationException("not grant/revoke request"));
                }
                return;
            }
            KiiCloudEngine.SetAuthBearer(client);

            // send request
            client.SendRequest((ApiResponse response, Exception e) =>
            {
                if (e != null)
                {
                    if (callback != null)
                    {
                        callback(null, e);
                    }
                    return;
                }
                if (callback != null)
                {
                    callback(this, null);
                }
            });
        }
Exemplo n.º 2
0
 /// <summary>
 /// Save this ACL entry.
 /// </summary>
 /// <remarks>
 /// Subscribe or send message to topic is not supported for <see cref="KiiAnonymousUser"/>.
 /// Saving this ACL entry throws <see cref="CloudException"/> if <see cref="KiiTopicACL"/> has been created with
 /// <see cref="KiiAnonymousUser"/> and <see cref="TopicAction"/>.
 /// <para>If operation is REVOKE and there is no entry in KiiCloud, KiiCloud will send error response.</para>
 /// </remarks>
 /// <param name='operation'>
 /// ACL operation. See <see cref="ACLOperation"/>
 /// </param>
 /// <param name='callback'>
 /// Callback.
 /// </param>
 public void Save(ACLOperation operation, KiiACLCallback <T, U> callback)
 {
     ExecSave(operation, Kii.AsyncHttpClientFactory, callback);
 }