/** * Constructor declaration * * * @param c * @param id */ public Channel(Channel c, int id) { iId = id; dDatabase = c.dDatabase; uUser = c.uUser; tTransaction = new ArrayList(); bAutoCommit = true; bReadOnly = c.bReadOnly; }
/** * Constructor declaration * * * @param name * @param password * @param admin * @param pub */ public User(string name, string password, bool admin, User pub) { hRight = new Hashtable(); sName = name; setPassword(password); bAdministrator = admin; uPublic = pub; }
/** * Constructor declaration * * * @param db * @param user * @param autocommit * @param readonly * @param id */ public Channel(Database db, User user, bool autocommit, bool ReadOnly, int id) { iId = id; dDatabase = db; uUser = user; tTransaction = new ArrayList(); bAutoCommit = autocommit; bReadOnly = ReadOnly; }
/** * Method declaration * * * @param user */ public void setUser(User user) { uUser = user; }
/** * Method declaration * * * @throws Exception */ public void disconnect() { if (bClosed) { return; } rollback(); dDatabase = null; uUser = null; tTransaction = null; bClosed = true; }
/** * Access Class constructor * <P>Creates a new ArrayList to contain the User object instances, as well * as creating an initial PUBLIC user, with no password. * * @throws Exception */ public Access() { uUser = new ArrayList(); uPublic = createUser("PUBLIC", null, false); }
/** * createUser method declaration * <P>This method is used to create a new user. The collection of users * is first checked for a duplicate name, and an exception will be thrown * if a user of the same name already exists. * * @param name (User login) * @param password (Plaintext password) * @param admin (Is this a database admin user?) * * @return An instance of the newly created User object */ public User createUser(string name, string password, bool admin) { for (int i = 0; i < uUser.Count; i++) { User u = (User)uUser[i]; if (u != null && u.getName().Equals(name)) { throw Trace.error(Trace.USER_ALREADY_EXISTS, name); } } User unew = new User(name, password, admin, uPublic); uUser.Add(unew); return unew; }