示例#1
0
        public IHttpActionResult Queue(string link)
        {
            var queue = QueueManager.GetQueue(link);

            if (queue == null)
            {
                return(NotFound());
            }

            int uid = Auth.CheckToken(Request.Headers);

            if (uid == 0 || !Auth.CheckAccess(uid, queue.Id))
            {
                return(StatusCode(HttpStatusCode.Forbidden));
            }

            var owner = UserAccessManager.GetOwner(queue.Id);

            if (owner == null)
            {
                return(InternalServerError());
            }

            var data = new QueueData(queue.Id, owner.UserId, queue.Name, owner.Nickname, queue.Link, queue.Timer);

            return(new ObjectResult(data, data.GetType(), Request));
        }