org.imsglobal.lti.launch.LtiUser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of basiclti-util Show documentation
Show all versions of basiclti-util Show documentation
BasicLTI Utilities are a set of utility classes to aid in the development of BasicLTI consumers and
providers. They deal with much of the heavy lifting and make the process more opaque to the developer.
The newest version!
package org.imsglobal.lti.launch;
import javax.servlet.http.HttpServletRequest;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* Created by paul on 5/28/14.
*/
public class LtiUser {
private String id;
private List roles;
public LtiUser(HttpServletRequest request) {
this.id = request.getParameter("user_id");
this.roles = new LinkedList<>();
if(request.getParameter("roles") != null) {
for (String role : request.getParameter("roles").split(",")) {
this.roles.add(role.trim());
}
}
}
public LtiUser(Map parameters) {
this.id = parameters.get("user_id");
this.roles = new LinkedList<>();
if(parameters.get("roles") != null) {
for (String role : parameters.get("roles").split(",")) {
this.roles.add(role.trim());
}
}
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List getRoles() {
return roles;
}
public void setRoles(List roles) {
this.roles = roles;
}
}