}
String[] parts = f.getName().split("\\.")[0].split("-", 2);
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT keyname, include, requires, name FROM `profiles` WHERE id=?");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `keyname`, `include`, `requires`, `name` FROM `profiles` WHERE `id`=?");
ps.setInt(1, Integer.parseInt(parts[0]));
GigiResultSet rs = ps.executeQuery();
throw new Error("Config error. Certificate Profile mismatch");
}
} else {
- GigiPreparedStatement insert = DatabaseConnection.getInstance().prepare("INSERT INTO `profiles` SET keyname=?, include=?, requires=?, name=?, id=?");
+ GigiPreparedStatement insert = DatabaseConnection.getInstance().prepare("INSERT INTO `profiles` SET `keyname`=?, `include`=?, `requires`=?, `name`=?, `id`=?");
insert.setString(1, parts[1]);
insert.setString(2, p.getProperty("include"));
insert.setString(3, p.getProperty("requires", ""));
}
}
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT id, keyname, name, requires, include FROM `profiles`");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `id`, `keyname`, `name`, `requires`, `include` FROM `profiles`");
GigiResultSet rs = ps.executeQuery();
while (rs.next()) {
CertificateProfile cp = new CertificateProfile(rs.getInt("id"), rs.getString("keyName"), rs.getString("name"), rs.getString("requires"), rs.getString("include"));
return byId.values().toArray(new CertificateProfile[byId.size()]);
}
- public boolean canBeIssuedBy(User u) {
+ public boolean canBeIssuedBy(CertificateOwner owner, User actor) {
+ if (pt.containsKey("orga")) {
+ if ( !(owner instanceof Organisation)) {
+ return false;
+ }
+ } else {
+ if (owner instanceof Organisation) {
+ return false;
+ }
+ }
for (String s : req) {
if (s.equals("points>=50")) {
- if (u.getAssurancePoints() < 50) {
+ if (actor.getAssurancePoints() < 50) {
return false;
}
} else if (s.equals("points>=100")) {
- if (u.getAssurancePoints() < 100) {
+ if (actor.getAssurancePoints() < 100) {
return false;
}
} else if (s.equals("codesign")) {
- if (u.isInGroup(Group.CODESIGNING)) {
+ if (actor.isInGroup(Group.CODESIGNING)) {
return false;
}
} else {