Example #1
0
        /// <summary>
        /// This method can be used for tracking and verification purposes.
        /// It gets the list of the secure documents that the current user
        /// is allowed to access.
        /// </summary>
        /// <returns></returns>
        public static List <UserAccessItem> GetUserAccessList()
        {
            List <UserAccessItem> _result = new List <UserAccessItem>();

            // Generate request
            using (Request _request = new Request(Service.Instance.InternalUser))
            {
                _request.MethodName = "security.getUserAccessList";
                _request.Parameters.Add("user_identifier", Service.User.UserName);

                // Get Results
                using (Response _response = Service.Instance.PostRequest(_request))
                {
                    // Parse response
                    if (_response != null && _response.HasChildNodes && _response.ErrorList.Count < 1)
                    {
                        XmlNodeList _list = _response.GetElementsByTagName("result");

                        if (_list.Count > 0)
                        {
                            foreach (XmlNode _node in _list)
                            {
                                UserAccessItem _item = new UserAccessItem();
                                _item.DocumentId     = int.Parse(_node.SelectSingleNode("doc_id").InnerText);
                                _item.SecretPassword = _node.SelectSingleNode("secret_password").InnerText;
                                _item.AccessKey      = _node.SelectSingleNode("access_key").InnerText;
                                _item.Title          = _node.SelectSingleNode("title").InnerText.Trim();
                                _item.Description    = _node.SelectSingleNode("description").InnerText.Trim();

                                switch (_node.SelectSingleNode("conversion_status").InnerText.Trim().ToLower())
                                {
                                case "displayable": _item.ConversionStatus = ConversionStatusTypes.Displayable; break;

                                case "done": _item.ConversionStatus = ConversionStatusTypes.Done; break;

                                case "error": _item.ConversionStatus = ConversionStatusTypes.Error; break;

                                case "processing": _item.ConversionStatus = ConversionStatusTypes.Processing; break;

                                case "published": _item.ConversionStatus = ConversionStatusTypes.Published; break;

                                default: _item.ConversionStatus = ConversionStatusTypes.None_Specified; break;
                                }

                                _item.PageCount = int.Parse(_node.SelectSingleNode("page_count").InnerText);

                                _result.Add(_item);
                            }
                        }
                    }
                }
            }

            return(_result);
        }
Example #2
0
        /// <summary>
        /// This method can be used for tracking and verification purposes. 
        /// It gets the list of the secure documents that the current user 
        /// is allowed to access.
        /// </summary>
        /// <returns></returns>
        public static List<UserAccessItem> GetUserAccessList()
        {
            List<UserAccessItem> _result = new List<UserAccessItem>();

            // Generate request
            using (Request _request = new Request(Service.Instance.InternalUser))
            {
                _request.MethodName = "security.getUserAccessList";
                _request.Parameters.Add("user_identifier", Service.User.UserName);
                
                // Get Results
                using (Response _response = Service.Instance.PostRequest(_request))
                {
                    // Parse response
                    if (_response != null && _response.HasChildNodes && _response.ErrorList.Count < 1)
                    {
                        XmlNodeList _list = _response.GetElementsByTagName("result");
                        
                        if (_list.Count > 0)
                        {
                            foreach (XmlNode _node in _list)
                            {
                                UserAccessItem _item = new UserAccessItem();
                                _item.DocumentId = int.Parse(_node.SelectSingleNode("doc_id").InnerText);
                                _item.SecretPassword = _node.SelectSingleNode("secret_password").InnerText;
                                _item.AccessKey = _node.SelectSingleNode("access_key").InnerText;
                                _item.Title = _node.SelectSingleNode("title").InnerText.Trim();
                                _item.Description = _node.SelectSingleNode("description").InnerText.Trim();
                                
                                switch (_node.SelectSingleNode("conversion_status").InnerText.Trim().ToLower())
                                {
                                    case "displayable": _item.ConversionStatus = ConversionStatusTypes.Displayable; break;
                                    case "done": _item.ConversionStatus = ConversionStatusTypes.Done; break;
                                    case "error": _item.ConversionStatus = ConversionStatusTypes.Error; break;
                                    case "processing": _item.ConversionStatus = ConversionStatusTypes.Processing; break;
                                    case "published": _item.ConversionStatus = ConversionStatusTypes.Published; break;
                                    default: _item.ConversionStatus = ConversionStatusTypes.None_Specified; break;
                                }

                                _item.PageCount = int.Parse(_node.SelectSingleNode("page_count").InnerText);

                                _result.Add(_item);
                            }
                        }
                    }
                }
            }

            return _result;
        }