ref: 3642ff2c921852babc8be83d5614fbadd32a8818
dir: /Bookproj/Admin.java/
package Bookproj; import java.time.LocalDateTime; import java.util.TreeMap; public class Admin extends BasicUser { private String Password; Admin(String user) { super(Role.Admin, user, (int)(Math.random()*100), LocalDateTime.now()); } Admin(String user, String Pass) { /* maybe check if password is too easy? */ super(Role.Admin, user, (int)(Math.random()*100), LocalDateTime.now()); this.setPassword(Pass); } boolean checkPass(String pass) { if (this.Password.equals(pass)) return true; else return false; } /* passwords should be unchangeable... for now */ protected void setPassword(String pass) { this.Password = pass; } TreeMap<AdminAttr, String> toMap() { TreeMap<AdminAttr, String> temp = new TreeMap<AdminAttr, String>(); temp.put(AdminAttr.Username, getUsername()); temp.put(AdminAttr.role, getRole().toString()); temp.put(AdminAttr.Reserved, getReserved()); temp.put(AdminAttr.ID, Integer.toString(getID())); temp.put(AdminAttr.RegTime, getRegTime().toString()); /* temp.put(Bookproj.AdminAttr.Password, this.Password); secrect secrect secrect */ temp.put(AdminAttr.Active, Boolean.toString(this.Active)); return temp; } }