コード例 #1
0
ファイル: System.cs プロジェクト: pluraldj/Random-Stuff
 public bool CanRead(Session sess, File item)
 {
     if (sess.CurrentUser == this.RootUser)
     {
         return true;
     }
     return item.CanView(sess.CurrentUser);
 }
コード例 #2
0
ファイル: System.cs プロジェクト: pluraldj/Random-Stuff
        public ComputerSystem()
        {
            this.RootUser = new User(this, "SYSTEM");
            this.Users.Add(this.RootUser);

            this.RootFile = new File("Root", 0, this.RootUser);
            this.RootFile.Directory = true;
            this.GenerateUsers();

            FileSystemGenerator.GenerateBasicFilesystem(this, new Session(this.RootUser));
        }
コード例 #3
0
ファイル: System.cs プロジェクト: pluraldj/Random-Stuff
        public ComputerSystem(Network parent)
        {
            this.Parent = parent;
            if (this.Parent.DomainControler != null)
            {
                this.Standalone = false;
            }
            else
            {
                this.GenerateUsers();
            }

            this.RootUser = new User(this, "SYSTEM");
            this.Users.Add(this.RootUser);

            this.RootFile = new File("Root", 0, this.RootUser);
            this.RootFile.Directory = true;
            FileSystemGenerator.GenerateBasicFilesystem(this, new Session(this.RootUser));
        }
コード例 #4
0
ファイル: System.cs プロジェクト: pluraldj/Random-Stuff
 public void FSCreateFile(string path, string name, int size, Session sess)
 {
     File currentDirectory = this.FSGetDirectory(path, sess);
     File newFile = new File(name, size, sess.CurrentUser);
     currentDirectory.Children.Add(newFile);
 }
コード例 #5
0
ファイル: System.cs プロジェクト: pluraldj/Random-Stuff
 public File GetDirectory(string name, bool create, User owner)
 {
     foreach (File item in this.Children)
     {
         if (item.Name == name && item.Directory)
         {
             return item;
         }
     }
     if (create)
     {
         File newFile = new File(name, 0, owner);
         newFile.Directory = true;
         this.Children.Add(newFile);
         return newFile;
     }
     else
     {
         return null;
     }
 }
コード例 #6
0
ファイル: System.cs プロジェクト: pluraldj/Random-Stuff
 public void FSSweepPremissions(File path, bool subdirectorys, UserGroup toJoin, FilePremission newPremission, Session sess)
 {
     foreach (File item in path.Children)
     {
         if (item.Directory)
         {
             if (!subdirectorys)
             {
                 continue;
             }
             this.FSSetPremission(item, toJoin, newPremission, sess);
             this.FSSweepPremissions(item, subdirectorys, toJoin, newPremission, sess);
         }
         else
         {
             this.FSSetPremission(item, toJoin, newPremission, sess);
         }
     }
 }
コード例 #7
0
ファイル: System.cs プロジェクト: pluraldj/Random-Stuff
 public void FSSetPremission(File item, UserGroup toJoin, FilePremission newPremission, Session sess)
 {
     if (item.CanView(sess.CurrentUser))
     {
         if (item.GroupPremitions.ContainsKey(toJoin))
         {
             item.GroupPremitions[toJoin] = newPremission;
         }
         else
         {
             item.GroupPremitions.Add(toJoin, newPremission);
         }
     }
 }