Esempio n. 1
0
        /// <summary>
        /// Determines whether the specified <see cref="object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
        /// <returns><c>true</c> if the specified object is equal to this instance; otherwise, <c>false</c>.</returns>
        public override bool Equals(object obj)
        {
            RequestCreate other = obj as RequestCreate;

            if (other == null)
            {
                return(false);
            }

            if (!base.Equals(obj))
            {
                return(false);
            }

            if (this.CreateMode != other.CreateMode)
            {
                return(false);
            }

            if (!EqualityHelper.Equals(this.Acl, other.Acl))
            {
                return(false);
            }

            return(EqualityHelper.Equals(this.Data, other.Data));
        }
Esempio n. 2
0
            /// <summary>
            /// runs the command from the path
            /// </summary>
            /// <param name="req">the request containing the command</param>
            /// <param name="session">the session this command was run from</param>
            /// <param name="lockList">the lock list of the invocation</param>
            /// <returns>the repsonse to the command</returns>
            internal virtual RequestResponse RunCommand(RequestCreate req, ClientSession session, ILockListTransaction lockList)
            {
                if (req == null)
                {
                    throw new ArgumentNullException(nameof(req));
                }

                if (session == null)
                {
                    throw new ArgumentNullException(nameof(session));
                }

                MutableStat stat = new MutableStat(new FirstStat(0, MutableStat.ConvertTime(DateTime.UtcNow), 0));

                // we require the digest 'Commander'
                if (!string.Equals(session.Auth.ClientDigest, CommanderDigest, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(new RequestResponse()
                    {
                        Content = "not executed",
                        ResponsePath = "command",
                        ResultCode = (int)Code.Authfailed,
                        Stat = stat,
                    });
                }

                string requestedCommand;
                object content;
                Code   result = this.RunCommandPath(req.Path, req.Data, session, lockList, out requestedCommand, out content);

                return(new RequestResponse()
                {
                    Content = content,
                    ResponsePath = requestedCommand,
                    ResultCode = (int)result,
                    Stat = stat,
                });
            }