]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/Certificate.java
fix: several testcases to the new configuration/structure
[gigi.git] / src / org / cacert / gigi / dbObjects / Certificate.java
index 479a183ae82a5c59d80c9ca4ae1649627572ed82..ada9ca90f2f589e6e075423c9e2e606a398aa6af 100644 (file)
@@ -135,7 +135,7 @@ public class Certificate {
     private CACertificate ca;
 
     public Certificate(User owner, HashMap<String, String> dn, String md, String csr, CSRType csrType, CertificateProfile profile, SubjectAlternateName... sans) throws GigiApiException {
-        if ( !owner.canIssue(profile)) {
+        if ( !profile.canBeIssuedBy(owner)) {
             throw new GigiApiException("You are not allowed to issue these certificates.");
         }
         this.owner = owner;
@@ -221,10 +221,10 @@ public class Certificate {
 
         crtName = rs.getString(1);
         serial = rs.getString(4);
-        ca = CACertificate.getById(rs.getInt("caid"));
         if (rs.getTimestamp(2) == null) {
             return CertificateStatus.DRAFT;
         }
+        ca = CACertificate.getById(rs.getInt("caid"));
         if (rs.getTimestamp(2) != null && rs.getTimestamp(3) == null) {
             return CertificateStatus.ISSUED;
         }