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)); }
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)); }
public Session(User currentUser) { this.CurrentUser = currentUser; }
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; } }
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; }
public File(string name, int size, User owner) { this.Name = name; this.Size = size; this.Creator = owner; }
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); }