1 package mircoders.module;
7 import javax.servlet.*;
8 import javax.servlet.http.*;
10 import freemarker.template.*;
18 import mircoders.entity.*;
19 import mircoders.storage.*;
29 public class ModuleUsers extends AbstractModule
31 static Logfile theLog;
35 public ModuleUsers(StorageObject theStorage)
38 if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Users.Logfile"));
39 if (theStorage == null) theLog.printWarning("StorageObject was null!");
40 this.theStorage = theStorage;
48 public EntityUsers getUserForLogin(String user, String password) throws ModuleException
50 String whereString = "login='" +user + "' and password='"+ password + "' and is_admin='1'";
51 EntityList userList = getByWhereClause(whereString, -1);
52 if (userList != null && userList.getCount()==1)
53 return (EntityUsers)userList.elementAt(0);
59 public EntityList getUsers(String whereClause, int offset, int limit)
60 throws ModuleException
63 return theStorage.selectByWhereClause(whereClause, null, offset, limit);
65 catch (StorageObjectException e){
66 throw new ModuleException(e.toString());
70 public SimpleList getUsersAsSimpleList() {
71 // String sql = "select id, name from Users order by name";
72 return ((DatabaseUsers)theStorage).getPopupData();