X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fcacert%2Fgigi%2FdbObjects%2FUser.java;h=dc79fd960cf7514d8e41b65373bbff267d73d5f0;hb=30a66c84a3f33e99bd5cbfe50b25a83acfbf5425;hp=6de799aeacb4e7a5461e1482b112ebf3bff59643;hpb=3e123160ad59a2e1162518923965562ff947b6d1;p=gigi.git diff --git a/src/org/cacert/gigi/dbObjects/User.java b/src/org/cacert/gigi/dbObjects/User.java index 6de799ae..dc79fd96 100644 --- a/src/org/cacert/gigi/dbObjects/User.java +++ b/src/org/cacert/gigi/dbObjects/User.java @@ -112,10 +112,6 @@ public class User implements IdCachable { this.email = email; } - public void setId(int id) { - this.id = id; - } - public void setFname(String fname) { this.name.fname = fname; } @@ -128,7 +124,7 @@ public class User implements IdCachable { if (id != 0) { throw new Error("refusing to insert"); } - GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("insert into `users` set `email`=?, `password`=?, " + "`fname`=?, `mname`=?, `lname`=?, " + "`suffix`=?, `dob`=?, `created`=NOW(), locked=0, `language`=?"); + GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("insert into `users` set `email`=?, `password`=?, " + "`fname`=?, `mname`=?, `lname`=?, " + "`suffix`=?, `dob`=?, `created`=NOW(), `language`=?"); query.setString(1, email); query.setString(2, PasswordHash.hash(password)); query.setString(3, name.fname); @@ -490,7 +486,7 @@ public class User implements IdCachable { return Collections.unmodifiableSet(groups); } - public void grantGroup(User granter, Group toGrant) throws GigiApiException { + public void grantGroup(User granter, Group toGrant) { groups.add(toGrant); GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO user_groups SET user=?, permission=?, grantedby=?"); ps.setInt(1, getId()); @@ -499,7 +495,7 @@ public class User implements IdCachable { ps.execute(); } - public void revokeGroup(User revoker, Group toRevoke) throws GigiApiException { + public void revokeGroup(User revoker, Group toRevoke) { groups.remove(toRevoke); GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("UPDATE user_groups SET deleted=CURRENT_TIMESTAMP, revokedby=? WHERE deleted is NULL AND permission=? AND user=?"); ps.setInt(1, revoker.getId());