public Coupon RequestExperimentAccess(long experimentID) { TicketIssuerDB ticketIssuer = new TicketIssuerDB(); Coupon coupon = null; //first try to recreate session if using a html client //if ((Session == null) || (Session["UserID"] == null) || (Session["UserID"].ToString() == "")) if (ticketIssuer.AuthenticateIssuedCoupon(opHeader.coupon)) { Ticket sessionTicket = ticketIssuer.RetrieveTicket(opHeader.coupon, TicketTypes.REDEEM_SESSION); if (sessionTicket != null) { if (sessionTicket.IsExpired()) { throw new AccessDeniedException("The ticket has expired."); } //Parse payload XmlQueryDoc expDoc = new XmlQueryDoc(sessionTicket.payload); // Get User & Group int userID = -1; int groupID = -1; string group = expDoc.Query("RedeemSessionPayload/groupID"); string user = expDoc.Query("RedeemSessionPayload/userID"); if (group != null && group.Length > 0) { groupID = Convert.ToInt32(group); } if (user != null && user.Length > 0) { userID = Convert.ToInt32(user); } //Check Qualifiers on experiment int status = wrapper.GetExperimentAuthorizationWrapper(experimentID, userID, groupID); //if accessable by user create new TicketCollection } } return coupon; }
public string GetAnnotation(int experimentID) { //first try to recreate session if using an html client if (Session == null || (Session["UserID"] == null) || (Session["UserID"].ToString() == "")) { wrapper.SetServiceSession(opHeader.coupon); } TicketIssuerDB ticketIssuer = new TicketIssuerDB(); if (ticketIssuer.AuthenticateIssuedCoupon(opHeader.coupon)) { try { //first try to recreate session if using a html client if (Session == null || (Session["UserID"] == null) || (Session["UserID"].ToString() == "")) wrapper.SetServiceSession(opHeader.coupon); return wrapper.SelectExperimentAnnotationWrapper(experimentID); } catch (Exception ex) { throw ex; } } else return null; }