KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > drftpd > master > usermanager > glftpd > GlftpdUser


1 /*
2  * This file is part of DrFTPD, Distributed FTP Daemon.
3  *
4  * DrFTPD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * DrFTPD is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with DrFTPD; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package net.sf.drftpd.master.usermanager.glftpd;
19
20 import java.util.Collection JavaDoc;
21 import java.util.Vector JavaDoc;
22
23 import net.sf.drftpd.DuplicateElementException;
24 import net.sf.drftpd.master.usermanager.AbstractUser;
25 import net.sf.drftpd.master.usermanager.UnixPassword;
26 import net.sf.drftpd.util.Crypt;
27
28 /**
29  * @author mog
30  * @author zubov
31  * @version $Id: GlftpdUser.java,v 1.9 2004/05/12 00:45:09 mog Exp $
32  */

33 public class GlftpdUser extends AbstractUser implements UnixPassword {
34     private String JavaDoc password;
35     //private String flags;
36
private Vector JavaDoc privateGroups = new Vector JavaDoc();
37     //private long weeklyAllotment;
38
//private GlftpdUserManager usermanager;
39

40     /**
41      * Constructor for GlftpdUser.
42      */

43     public GlftpdUser(String JavaDoc username) {
44         super(username);
45         //this.usermanager = usermanager;
46
}
47     public void addPrivateGroup(String JavaDoc group)
48         throws DuplicateElementException {
49         addGroup(group);
50         privateGroups.add(group);
51     }
52     public boolean checkPassword(String JavaDoc userPassword) {
53         String JavaDoc userhash =
54             Crypt.crypt(this.password.substring(0, 2), userPassword);
55         if (password.equals(userhash)) {
56             login();
57             return true;
58         }
59         return false;
60     }
61     public void commit() {
62         throw new UnsupportedOperationException JavaDoc();
63     }
64     /*
65      * no such thing in glftpd userfiles
66      */

67     public long getCreated() {
68         return 0;
69     }
70
71     public long getLastReset() {
72         return System.currentTimeMillis();
73     }
74     /**
75     * Sets the flags.
76     * @param flags The flags to set
77     */

78     //public void setFlags(String flags) {
79
// this.flags = flags;
80
//}
81
/**
82     * Returns the privateGroups.
83     * @return Vector
84     */

85     public Collection JavaDoc getPrivateGroups() {
86         return privateGroups;
87     }
88
89     public String JavaDoc getUnixPassword() {
90         return password;
91     }
92     public long getWeeklyAllotment() {
93         return weeklyAllotment;
94     }
95     public void purge() {
96         throw new UnsupportedOperationException JavaDoc();
97     }
98     public void rename(String JavaDoc name) {
99         throw new UnsupportedOperationException JavaDoc();
100     }
101     /**
102     * Sets the password.
103     * @param password The password to set
104     */

105     public void setPassword(String JavaDoc password) {
106         throw new UnsupportedOperationException JavaDoc();
107         //must be encrypted...
108
//this.password = password;
109
}
110
111     public void setUnixPassword(String JavaDoc password) {
112         this.password = password;
113     }
114     public void setWeeklyAllotment(long weeklyAllotment) {
115         this.weeklyAllotment = weeklyAllotment;
116     }
117     public void update() {
118         throw new UnsupportedOperationException JavaDoc();
119     }
120
121     public void updateCredits(long credits) {
122         throw new UnsupportedOperationException JavaDoc();
123     }
124     /**
125      * @see net.sf.drftpd.master.usermanager.User#updateDownloadedBytes(long)
126      */

127     public void updateDownloadedBytes(long bytes) {
128         throw new UnsupportedOperationException JavaDoc();
129     }
130     /**
131     * @see net.sf.drftpd.master.usermanager.User#updateUploadedBytes(long)
132     */

133     public void updateUploadedBytes(long bytes) {
134         throw new UnsupportedOperationException JavaDoc();
135     }
136
137 }
Popular Tags