/// <summary>
        /// Received the SharedObjectSecurity information for an object, set it internally
        /// </summary>
        /// <param name="payload"></param>
        private void GotAccessControl(SharedObjectSecurityPayload payload)
        {
            var data = payload.SharedObjectSecurity;

            // Check if the data payload is a response to a request we have pending in our Async queue
            ISharedAsyncResult ar;

            if (!activeAsyncOperations.TryGetValue(payload.PayloadId, out ar))
            {
                Debug.Assert(false, "No matching asyncresult operation for the GetAccessControl call");
                return;
            }

            // We know that the async results for GotAccessControl will be a SharedObjectSecurity object
            var result = (SharedAsyncResult <SharedObjectSecurity>)ar;

            ISharedObjectEntry sharedObjectEntry = GetObjectEntry(payload);

            if (sharedObjectEntry == null)
            {
                // Object/Collection does not exist, cannot set the AccessControl for it
                var error = new ObjectErrorPayload(SharedObjects.Error.ObjectNotFound, data.ObjectId, data.ObjectName, "", payload.ClientId, payload.PayloadId);
                this.CompleteAsyncResult(result, payload.PayloadId);
                RaiseError(error);
                return;
            }

            sharedObjectEntry.ObjectSecurity = data;
            this.CompleteAsyncResult <SharedObjectSecurity>(result, data, payload.PayloadId);
        }
Exemple #2
0
        /// <summary>
        /// Received the SharedObjectSecurity information for an object, set it internally
        /// </summary>
        /// <param name="payload"></param>
        private void GotEvictionPolicy(EvictionPolicyPayload payload)
        {
            var data = payload.Policy;

            // Check if the data payload is a response to a request we have pending in our Async queue
            ISharedAsyncResult ar;

            if (!activeAsyncOperations.TryGetValue(payload.PayloadId, out ar))
            {
                Debug.Assert(false, "No matching asyncresult operation for the GetEvictionPolicy call");
                return;
            }

            // We know that the async results for GotEvictionPolicy will be a SharedObjectSecurity object
            var result = (SharedAsyncResult <EvictionPolicy>)ar;

            ISharedObjectEntry sharedObjectEntry = GetSharedEntry(true, payload.EntryId);

            if (sharedObjectEntry == null)
            {
                // Object/Collection does not exist, cannot set the AccessControl for it
                var error = new ObjectErrorPayload(SharedObjects.Error.ObjectNotFound, payload.EntryId, "", "EvictionPolicy was retrieved for object that is no longer in scope on the client", payload.ClientId, payload.PayloadId);
                this.CompleteAsyncResult(result, payload.PayloadId);
                RaiseError(error);
                return;
            }

            this.CompleteAsyncResult <EvictionPolicy>(result, payload.Policy, payload.PayloadId);
        }
        public void SetAccessControl(SharedObjectSecurity objectSecurity)
        {
            var payload = new SharedObjectSecurityPayload(PayloadAction.Set, objectSecurity, this.ClientId);

            // Update the locally cached copy of the security object, if the change fails the actual security
            // information will be sent down
            ISharedObjectEntry sharedObjectEntry = GetObjectEntry(payload);

            Debug.Assert(sharedObjectEntry != null);
            sharedObjectEntry.ObjectSecurity = objectSecurity;

            this.activeAsyncOperations[payload.PayloadId] = null;

            this.SendPublishEvent(payload);
        }
Exemple #4
0
 internal ObjectDeletedPayload(ISharedObjectEntry entry, Guid clientId)
     : base(entry.Name, entry.Id, clientId)
 {
 }
Exemple #5
0
 public CollectionDeletedPayload(ISharedObjectEntry entry, Guid clientId)
     : base(entry.Name, entry.Id, clientId)
 { }
Exemple #6
0
 public ModifyCollectionErrorPayload(Error errorType, ISharedObjectEntry objectEntry, ISharedObjectEntry collectionEntry, string description, Guid clientId, ushort payloadId) :
     base(errorType, objectEntry, description, clientId, payloadId)
 {
     this.CollectionId = collectionEntry.Id;
     this.CollectionName = collectionEntry.Name;
 }
Exemple #7
0
 public ObjectPropertyErrorPayload(Error error, ISharedObjectEntry entry, Int16 propertyIndex, string description, Guid clientId, ushort payloadId) :
     base(error, entry, description, clientId, payloadId)
 {
     this.PropertyIndex = propertyIndex;
     this.PropertyName = String.Empty;
 }
Exemple #8
0
 public UnauthorizedErrorPayload(Error errorType, ISharedObjectEntry objectEntry, ObjectRights requiredRights, string description, Guid clientId, ushort payloadId) :
     base(errorType, objectEntry, description, clientId, payloadId)
 {
     this.RequiredRights = requiredRights;
 }
Exemple #9
0
 public ObjectErrorPayload(Error errorType, ISharedObjectEntry objectEntry, string description, Guid clientId, ushort payloadId) :
     base(errorType, String.Empty, description, clientId, payloadId)
 {
     this.ObjectId = objectEntry.Id;
     this.ObjectName = objectEntry.Name;
 }