public async Task <Response> RemoveShare(RemoveShareRequest request)
        {
            Response retval = new RemoveShareResponseInvalidID(request);

            if (!_dal.IsShareExists(_conn, request.Share))
            {
                retval = new RemoveShareResponseInvalidID(request);
            }
            else if (request.UserID != request.Share.UserID && !_dal.IsUserOwner(_conn, request.UserID, request.Share.DocID))
            {
                retval = new RemoveShareResponseNotAuthorized(request);
            }
            else
            {
                try
                {
                    _dal.removeShare(_conn, request.Share);
                    retval = new RemoveShareResponseOK(request);
                    await _webSocket.Notify("remove share: " + request.Share.ToString());
                }
                catch
                {
                    retval = new AppResponseError("Error in server in remove share");
                }
            }
            return(retval);
        }
예제 #2
0
 public Response RemoveShare(RemoveShareRequest request)
 {
     try
     {
         _dal.RemoveShare(request.UserId, request.DocId);
         var            retval = new RemoveShareResponseOK();
         MessageRequest msg    = new MessageRequest(request.UserId, request.DocId, "sharingDeleted");
         _wsService.Send(msg);
         return(retval);
     }
     catch (Exception ex)
     {
         return(new ResponseError(ex.Message));
     }
 }
예제 #3
0
        public async Task <Response> RemoveShare(RemoveShareRequest request)
        {
            Response response = new RemoveShareResponseInvalidUserID(request);

            if (_dal.isUserExists(request.Share.UserID) && _dal.isDocExists(request.Share.DocID))
            {
                try
                {
                    //remove share
                    DataSet ds = _dal.RemoveShare(request.Share.DocID, request.Share.UserID);
                    response = new RemoveShareResponseOK(request);
                    //update user for new share
                    await _socket.Send(request.Share.UserID, "newDocumentUpdate");
                }
                catch (Exception ex)
                {
                    response = new AppResponseError(ex.Message);
                }
            }
            return(response);
        }