diff options
author | Endi S. Dewata <edewata@redhat.com> | 2014-08-15 15:16:31 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2014-08-15 19:17:47 -0400 |
commit | e749dad93d9d203a86ef7c2b35b106c2c3f68c21 (patch) | |
tree | 397fee6270aacf367e22cb91e87843296bc245ba /base/tps-tomcat | |
parent | 729c60539b43efa17cc54553b9589aece509cffa (diff) | |
download | pki-e749dad93d9d203a86ef7c2b35b106c2c3f68c21.tar.gz pki-e749dad93d9d203a86ef7c2b35b106c2c3f68c21.tar.xz pki-e749dad93d9d203a86ef7c2b35b106c2c3f68c21.zip |
Fixed missing TPS token attributes.
The missing token policy attribute has been added to token database. The
REST services, CLI, and UI have been fixed accordingly. Other missing
attributes in tokenRecord object class are unused.
Ticket #1085
Diffstat (limited to 'base/tps-tomcat')
6 files changed, 93 insertions, 32 deletions
diff --git a/base/tps-tomcat/shared/webapps/tps/js/token.js b/base/tps-tomcat/shared/webapps/tps/js/token.js index 085003a1e..2ea17714e 100644 --- a/base/tps-tomcat/shared/webapps/tps/js/token.js +++ b/base/tps-tomcat/shared/webapps/tps/js/token.js @@ -40,6 +40,7 @@ var TokenModel = Model.extend({ statusLabel: TokenStatus[response.Status], appletID: response.AppletID, keyInfo: response.KeyInfo, + policy: response.Policy, createTimestamp: response.CreateTimestamp, modifyTimestamp: response.ModifyTimestamp }; @@ -53,6 +54,7 @@ var TokenModel = Model.extend({ Status: attributes.status, AppletID: attributes.appletID, KeyInfo: attributes.keyInfo, + Policy: attributes.policy, CreateTimestamp: attributes.createTimestamp, ModifyTimestamp: attributes.modifyTimestamp }; @@ -91,6 +93,7 @@ var TokenCollection = Collection.extend({ statusLabel: TokenStatus[entry.Status], appletID: entry.AppletID, keyInfo: entry.KeyInfo, + policy: entry.Policy, createTimestamp: entry.CreateTimestamp, modifyTimestamp: entry.ModifyTimestamp }); @@ -191,7 +194,8 @@ var TokenTableItem = TableItem.extend({ el: $("#token-status-dialog"), title: "Change Token Status", readonly: ["tokenID", "userID", "type", - "appletID", "keyInfo", "createTimestamp", "modifyTimestamp"], + "appletID", "keyInfo", "policy", + "createTimestamp", "modifyTimestamp"], actions: ["cancel", "save"] }); diff --git a/base/tps-tomcat/shared/webapps/tps/ui/index.html b/base/tps-tomcat/shared/webapps/tps/ui/index.html index d1fa78b67..eddceefd7 100644 --- a/base/tps-tomcat/shared/webapps/tps/ui/index.html +++ b/base/tps-tomcat/shared/webapps/tps/ui/index.html @@ -272,7 +272,7 @@ $(function() { el: content, url: "token.html", model: new TokenModel({ id: id }), - editable: ["userID", "type", "appletID", "keyInfo"] + editable: ["userID", "type", "appletID", "keyInfo", "policy"] }).open(); }); @@ -283,7 +283,7 @@ $(function() { model: new TokenModel(), mode: "add", title: "New Token", - editable: ["tokenID", "userID", "type", "appletID", "keyInfo"], + editable: ["tokenID", "userID", "type", "appletID", "keyInfo", "policy"], parentHash: "#tokens" }).open(); }); diff --git a/base/tps-tomcat/shared/webapps/tps/ui/token.html b/base/tps-tomcat/shared/webapps/tps/ui/token.html index 6d34af5d2..78384acfe 100644 --- a/base/tps-tomcat/shared/webapps/tps/ui/token.html +++ b/base/tps-tomcat/shared/webapps/tps/ui/token.html @@ -54,6 +54,8 @@ <input name="appletID" readonly="readonly"><br> <label>Key Info</label> <input name="keyInfo" readonly="readonly"><br> + <label>Policy</label> + <input name="policy" readonly="readonly"><br> <label>Created</label> <input name="createTimestamp" readonly="readonly"><br> <label>Modified</label> diff --git a/base/tps-tomcat/shared/webapps/tps/ui/tokens.html b/base/tps-tomcat/shared/webapps/tps/ui/tokens.html index 98ae769aa..aca579a68 100644 --- a/base/tps-tomcat/shared/webapps/tps/ui/tokens.html +++ b/base/tps-tomcat/shared/webapps/tps/ui/tokens.html @@ -27,7 +27,7 @@ <table name="tokens"> <thead> <tr> - <th class="pki-table-actions" colspan="9"> + <th class="pki-table-actions" colspan="10"> <span name="search"> <input name="search" type="text" placeholder="Search..."> </span> @@ -45,6 +45,7 @@ <th>Status</th> <th>Applet ID</th> <th>Key Info</th> + <th>Policy</th> <th>Created</th> <th>Modified</th> </tr> @@ -58,13 +59,14 @@ <td name="status"><a href="#tokens/${id}/status">${statusLabel}</a></td> <td name="appletID">${appletID}</td> <td name="keyInfo">${keyInfo}</td> + <td name="policy">${policy}</td> <td name="created">${createTimestamp}</td> <td name="modified">${modifyTimestamp}</td> </tr> </tbody> <tfoot> <tr> - <th class="pki-table-actions" colspan="9"> + <th class="pki-table-actions" colspan="10"> <div class="pki-table-info"> Total: <span name="totalEntries">0</span> entries </div> @@ -96,35 +98,37 @@ <h4 class="modal-title">Change Token Status</h4> </div> <div class="modal-body"> - <fieldset> - <label>Token ID</label> - <input name="tokenID" readonly="readonly"><br> - <label>User ID</label> - <input name="userID" readonly="readonly"><br> - <label>Type</label> - <input name="type" readonly="readonly"><br> - <label>Status</label> - <select name="status"> - <option value="UNINITIALIZED">Uninitialized</option> - <option value="ACTIVE">Active</option> - <option value="TEMP_LOST">Temporarily lost</option> - <option value="PERM_LOST">Permanently lost</option> - <option value="DAMAGED">Physically damaged</option> - <option value="TERMINATED">Terminated</option> - </select><br> - <label>Applet ID</label> - <input name="appletID" readonly="readonly"><br> - <label>Key Info</label> - <input name="keyInfo" readonly="readonly"><br> - <label>Created</label> - <input name="createTimestamp" readonly="readonly"><br> - <label>Modified</label> - <input name="modifyTimestamp" readonly="readonly"><br> - </fieldset> + <fieldset> + <label>Token ID</label> + <input name="tokenID" readonly="readonly"><br> + <label>User ID</label> + <input name="userID" readonly="readonly"><br> + <label>Type</label> + <input name="type" readonly="readonly"><br> + <label>Status</label> + <select name="status"> + <option value="UNINITIALIZED">Uninitialized</option> + <option value="ACTIVE">Active</option> + <option value="TEMP_LOST">Temporarily lost</option> + <option value="PERM_LOST">Permanently lost</option> + <option value="DAMAGED">Physically damaged</option> + <option value="TERMINATED">Terminated</option> + </select><br> + <label>Applet ID</label> + <input name="appletID" readonly="readonly"><br> + <label>Key Info</label> + <input name="keyInfo" readonly="readonly"><br> + <label>Policy</label> + <input name="policy" readonly="readonly"><br> + <label>Created</label> + <input name="createTimestamp" readonly="readonly"><br> + <label>Modified</label> + <input name="modifyTimestamp" readonly="readonly"><br> + </fieldset> </div> <div class="modal-footer"> - <button name="save" class="btn btn-primary">Save</button> - <button name="cancel" class="btn btn-default" data-dismiss="modal">Cancel</button> + <button name="save" class="btn btn-primary">Save</button> + <button name="cancel" class="btn btn-default" data-dismiss="modal">Cancel</button> </div> </div> </div> diff --git a/base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java b/base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java index 11fecce58..a1aef5720 100644 --- a/base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java +++ b/base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java @@ -33,6 +33,32 @@ public class TokenRecord extends DBRecord { private static final long serialVersionUID = 1L; + /** + * objectClasses: ( tokenRecord-oid + * NAME 'tokenRecord' + * DESC 'CMS defined class' + * SUP top + * STRUCTURAL + * MUST cn + * MAY ( + * dateOfCreate $ + * dateOfModify $ + * modified $ (unused) + * tokenReason $ + * tokenUserID $ + * tokenStatus $ + * tokenAppletID $ + * keyInfo $ + * tokenPolicy $ + * extensions $ (unused) + * numberOfResets $ (unused) + * numberOfEnrollments $ (unused) + * numberOfRenewals $ (unused) + * numberOfRecoveries $ (unused) + * userCertificate $ (unused) + * tokenType ) + * X-ORIGIN 'user defined' ) + */ String id; String userID; String type; @@ -40,6 +66,7 @@ public class TokenRecord extends DBRecord { String reason; String appletID; String keyInfo; + String policy; Date createTimestamp; Date modifyTimestamp; @@ -106,6 +133,15 @@ public class TokenRecord extends DBRecord { this.keyInfo = keyInfo; } + @DBAttribute("tokenPolicy") + public String getPolicy() { + return policy; + } + + public void setPolicy(String policy) { + this.policy = policy; + } + @DBAttribute("dateOfCreate") public Date getCreateTimestamp() { return createTimestamp; @@ -133,6 +169,7 @@ public class TokenRecord extends DBRecord { result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((keyInfo == null) ? 0 : keyInfo.hashCode()); result = prime * result + ((modifyTimestamp == null) ? 0 : modifyTimestamp.hashCode()); + result = prime * result + ((policy == null) ? 0 : policy.hashCode()); result = prime * result + ((reason == null) ? 0 : reason.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); @@ -174,6 +211,11 @@ public class TokenRecord extends DBRecord { return false; } else if (!modifyTimestamp.equals(other.modifyTimestamp)) return false; + if (policy == null) { + if (other.policy != null) + return false; + } else if (!policy.equals(other.policy)) + return false; if (reason == null) { if (other.reason != null) return false; diff --git a/base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java b/base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java index 09adf5491..84046a964 100644 --- a/base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java +++ b/base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java @@ -164,6 +164,7 @@ public class TokenService extends PKIService implements TokenResource { tokenData.setStatus(getTokenStatus(tokenRecord)); tokenData.setAppletID(tokenRecord.getAppletID()); tokenData.setKeyInfo(tokenRecord.getKeyInfo()); + tokenData.setPolicy(tokenRecord.getPolicy()); tokenData.setCreateTimestamp(tokenRecord.getCreateTimestamp()); tokenData.setModifyTimestamp(tokenRecord.getModifyTimestamp()); @@ -190,6 +191,7 @@ public class TokenService extends PKIService implements TokenResource { setTokenStatus(tokenRecord, tokenData.getStatus()); tokenRecord.setAppletID(tokenData.getAppletID()); tokenRecord.setKeyInfo(tokenData.getKeyInfo()); + tokenRecord.setPolicy(tokenData.getPolicy()); tokenRecord.setCreateTimestamp(tokenData.getCreateTimestamp()); tokenRecord.setModifyTimestamp(tokenData.getModifyTimestamp()); @@ -330,6 +332,7 @@ public class TokenService extends PKIService implements TokenResource { tokenRecord.setType(tokenData.getType()); tokenRecord.setAppletID(tokenData.getAppletID()); tokenRecord.setKeyInfo(tokenData.getKeyInfo()); + tokenRecord.setPolicy(tokenData.getPolicy()); database.updateRecord(tokenID, tokenRecord); subsystem.tdb.tdbActivity(subsystem, ActivityDatabase.OP_DO_TOKEN, tokenRecord, ipAddress, msg, "success", @@ -393,6 +396,12 @@ public class TokenService extends PKIService implements TokenResource { tokenRecord.setKeyInfo(keyInfo); } + // update policy if specified + String policy = tokenData.getPolicy(); + if (policy != null) { + tokenRecord.setPolicy(policy); + } + database.updateRecord(tokenID, tokenRecord); subsystem.tdb.tdbActivity(subsystem, ActivityDatabase.OP_DO_TOKEN, tokenRecord, ipAddress, msg, "success", |