Beispiel #1
0
        public bool ISBPAFileWritable(IYZDbProvider provider, IDbConnection cn, BPMConnection bpmcn)
        {
            Folder parentFolder = DirectoryManager.GetFolderByID(provider, cn, this.FolderID);
            Folder rootFolder   = DirectoryManager.GetFolderByID(provider, cn, parentFolder.RootID);

            if (NameCompare.EquName(rootFolder.FolderType, "BPALibrary"))
            {
                if (SecurityManager.CheckPermision(bpmcn, parentFolder.RSID, BPMPermision.Write))
                {
                    return(true);
                }
            }

            if (NameCompare.EquName(rootFolder.FolderType, "BPAGroup"))
            {
                if (bpmcn.Token.ContainsSID(WellKnownSID.Administrators))
                {
                    return(true);
                }

                YZSoft.Group.Group  group  = YZSoft.Group.GroupManager.GetGroupFromFolderID(provider, cn, rootFolder.FolderID);
                YZSoft.Group.Member member = YZSoft.Group.GroupManager.TryGetGroupMember(provider, cn, group.GroupID, YZAuthHelper.LoginUserAccount);
                if (member != null)
                {
                    if ((member.GroupPerm & Group.GroupPerm.Edit) == Group.GroupPerm.Edit || (member.GroupPerm & Group.GroupPerm.Auth) == Group.GroupPerm.Auth)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #2
0
        public static void MoveFolders(IYZDbProvider provider, IDbConnection cn, int[] folderids, int targetfolderid, MovePosition position)
        {
            Folder           targetFolder = DirectoryManager.GetFolderByID(provider, cn, targetfolderid);
            FolderCollection folders;
            int parentFolderId;

            if (position == MovePosition.Append)
            {
                parentFolderId = targetFolder.FolderID;
            }
            else
            {
                parentFolderId = targetFolder.ParentID;
            }

            foreach (int folderid in folderids)
            {
                Folder folder = new Folder();
                folder.FolderID = folderid;
                folder.ParentID = parentFolderId;
                folder.RootID   = targetFolder.RootID;
                DirectoryManager.UpdateParent(provider, cn, folder);
            }

            folders = DirectoryManager.GetFolders(provider, cn, parentFolderId, null, null);

            folders.Move <int>("FolderID", folderids, targetfolderid, position);

            for (int i = 0; i < folders.Count; i++)
            {
                Folder folder = folders[i];
                folder.OrderIndex = i;
                DirectoryManager.UpdateOrderIndex(provider, cn, folder);
            }
        }