示例#1
0
        public virtual JObject CreateNewFolder(HttpContext context)
        {
            YZRequest     request = new YZRequest(context);
            StoreZoneType zone    = request.GetEnum <StoreZoneType>("zone");
            string        path    = request.GetString("path", "");

            string folderName;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                folderName = cn.CreateNewFolder(zone, path);
            }

            string folderPath;

            if (String.IsNullOrEmpty(path))
            {
                folderPath = folderName;
            }
            else
            {
                folderPath = path + "/" + folderName;
            }

            JObject item = new JObject();

            item["leaf"]    = false;
            item["text"]    = folderName;
            item["iconCls"] = "folder";
            item["path"]    = folderPath;
            item["rsid"]    = zone.ToString() + "://" + folderPath;
            return(item);
        }
示例#2
0
        protected virtual void ExpandTree(BPMConnection cn, JArray items, string path, StoreZoneType zone, bool expand)
        {
            BPMObjectNameCollection folderNames = cn.GetFolders(zone, path, BPMPermision.Read);

            foreach (String folderName in folderNames)
            {
                string folderPath;

                if (String.IsNullOrEmpty(path))
                {
                    folderPath = folderName;
                }
                else
                {
                    folderPath = path + "/" + folderName;
                }

                JObject item = new JObject();
                items.Add(item);
                item["leaf"]     = false;
                item["text"]     = folderName;
                item["iconCls"]  = "folder";
                item["expanded"] = expand;
                item["path"]     = folderPath;
                item["rsid"]     = zone.ToString() + "://" + folderPath;

                JArray children = new JArray();
                item[YZJsonProperty.children] = children;
                this.ExpandTree(cn, children, folderPath, zone, expand);
            }
        }
示例#3
0
        public virtual JObject GetStoreObjectPerms(HttpContext context)
        {
            YZRequest               request  = new YZRequest(context);
            StoreZoneType           zone     = request.GetEnum <StoreZoneType>("zone");
            string                  path     = request.GetString("path", null);
            string                  strPerms = request.GetString("perms", null);
            BPMObjectNameCollection ids      = BPMObjectNameCollection.FromStringList(request.GetString("ids", ""), ',');;

            BPMPermision[] bpmPerms = YZSecurityHelper.ParsePermisions(strPerms);

            JObject rv    = new JObject();
            JObject perms = new JObject();

            rv["perms"] = perms;

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

                foreach (string id in ids)
                {
                    string fullName;
                    if (String.IsNullOrEmpty(path))
                    {
                        fullName = id;
                    }
                    else
                    {
                        fullName = path + "/" + id;
                    }

                    ACL acl = SecurityManager.GetACL(cn, zone.ToString() + "://" + fullName);

                    JObject jPerm = new JObject();
                    perms[id] = jPerm;

                    foreach (BPMPermision perm in bpmPerms)
                    {
                        jPerm[perm.ToString()] = acl.HasPermision(cn.Token, perm);
                    }
                }
            }

            rv[YZJsonProperty.success] = true;
            return(rv);
        }