Example #1
0
        public virtual object[] GetServersInFolder(HttpContext context)
        {
            YZRequest    request = new YZRequest(context);
            string       path    = request.GetString("path", null);
            string       rsid    = String.IsNullOrEmpty(path) ? WellKnownRSID.ExtServerRoot : StoreZoneType.ExtServer.ToString() + "://" + path;
            BPMPermision perm    = request.GetEnum <BPMPermision>("perm");

            ExtServerCollection extServers = new ExtServerCollection();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                if (SecurityManager.CheckPermision(cn, rsid, perm))
                {
                    extServers = cn.GetExtServerList(path, perm);
                }
            }

            List <object> rv = new List <object>();

            foreach (ExtServer extServer in extServers)
            {
                if (extServer.ServerType == ServerType.Local)
                {
                    continue;
                }

                rv.Add(new
                {
                    ServerType = extServer.ServerType.ToString(),
                    Name       = extServer.Name,
                    Host       = extServer.Host
                });
            }

            return(rv.ToArray());
        }