All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.imsglobal.lti.launch.LtiUser Maven / Gradle / Ivy

Go to download

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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy