예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
 public Session(User currentUser)
 {
     this.CurrentUser = currentUser;
 }
예제 #4
0
 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;
     }
 }
예제 #5
0
 public bool CanView(User usr)
 {
     if (usr == this.Creator)
     {
         return true;
     }
     if (this.Premitions.ContainsKey(usr))
     {
         return this.Premitions[usr].Read;
     }
     foreach (UserGroup item in usr.Membership)
     {
         if (this.GroupPremitions.ContainsKey(item))
         {
             return this.GroupPremitions[item].Read;
         }
     }
     return false;
 }
예제 #6
0
 public File(string name, int size, User owner)
 {
     this.Name = name;
     this.Size = size;
     this.Creator = owner;
 }
예제 #7
0
        public void GenerateUsers()
        {
            this.Groups.Add(new UserGroup("Admins"));

            User admin = new User(this, "Admin");
            admin.Membership.Add(this.GetGroup("Admins"));
            this.Users.Add(admin);
        }