Search in sources :

Example 91 with AssertException

use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.

the class AdobeConnectProvider method removeClassroom.

@Override
public boolean removeClassroom(String roomId, VCConfiguration config) {
    if (!existsClassroom(roomId, config))
        return true;
    if (!loginAdmin())
        throw new AssertException("Cannot login to Adobe Connect. Please check module configuration and that Adobe Connect is available.");
    String scoId = getScoIdFor(roomId);
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("action", "sco-delete");
    parameters.put("sco-id", scoId);
    Document responseDoc = getResponseDocument(sendRequest(parameters));
    if (!evaluateOk(responseDoc))
        return false;
    logout();
    return true;
}
Also used : AssertException(org.olat.core.logging.AssertException) HashMap(java.util.HashMap) Document(org.w3c.dom.Document)

Example 92 with AssertException

use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.

the class AdobeConnectProvider method getPrincipalIdFor.

private String getPrincipalIdFor(Identity identity) {
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("action", "principal-list");
    parameters.put("filter-type", userType);
    parameters.put("filter-type", "user");
    parameters.put("filter-login", PREFIX + identity.getName());
    String response = sendRequest(parameters);
    Document responseDoc = getResponseDocument(response);
    boolean success = evaluateOk(responseDoc);
    if (!success)
        return null;
    // get principalId
    NodeList nodes = (NodeList) evaluate(responseDoc, "//principal", XPathConstants.NODESET);
    // error case
    if (nodes == null)
        return null;
    if (nodes.getLength() == 1) {
        String principalId = evaluate(responseDoc, "//principal[1]/attribute::principal-id");
        return principalId;
    } else if (nodes.getLength() > 1) {
        throw new AssertException("Multiple Adobe Connect users with the same login name found: " + identity.getName());
    } else
        return null;
}
Also used : AssertException(org.olat.core.logging.AssertException) HashMap(java.util.HashMap) NodeList(org.w3c.dom.NodeList) Document(org.w3c.dom.Document)

Example 93 with AssertException

use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.

the class AdobeConnectProvider method existsClassroom.

@Override
public boolean existsClassroom(String roomId, VCConfiguration config) {
    if (!loginAdmin())
        return false;
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("action", "sco-search-by-field");
    parameters.put("query", PREFIX + roomId);
    parameters.put("filter-type", "meeting");
    Document responseDoc = getResponseDocument(sendRequest(parameters));
    if (!evaluateOk(responseDoc))
        return false;
    Object result = evaluate(responseDoc, "//sco/url-path[text()='/" + PREFIX + roomId + "/']", XPathConstants.NODESET);
    logout();
    if (result == null)
        return false;
    NodeList nodes = (NodeList) result;
    if (nodes.getLength() == 1)
        return true;
    else if (nodes.getLength() > 1)
        throw new AssertException("More than one Adobe Connect room found for one course node!");
    else
        return false;
}
Also used : AssertException(org.olat.core.logging.AssertException) HashMap(java.util.HashMap) NodeList(org.w3c.dom.NodeList) Document(org.w3c.dom.Document)

Example 94 with AssertException

use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.

the class AuthHelper method createAuthHome.

/**
 * Create a base chief controller for the current authenticated user request
 * and initialize the first screen after login.
 *
 * @param ureq The authenticated user request.
 * @return The chief controller
 */
public static ChiefController createAuthHome(UserRequest ureq) {
    if (!ureq.getUserSession().isAuthenticated())
        throw new AssertException("not authenticated!");
    BaseFullWebappControllerParts authSitesAndNav = new AuthBFWCParts();
    ChiefController cc = new BaseFullWebappController(ureq, authSitesAndNav);
    Windows.getWindows(ureq.getUserSession()).setChiefController(cc);
    return cc;
}
Also used : BaseFullWebappController(org.olat.core.commons.fullWebApp.BaseFullWebappController) AssertException(org.olat.core.logging.AssertException) AuthBFWCParts(org.olat.login.AuthBFWCParts) BaseFullWebappControllerParts(org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts) ChiefController(org.olat.core.gui.control.ChiefController)

Example 95 with AssertException

use of org.olat.core.logging.AssertException in project OpenOLAT by OpenOLAT.

the class AuthHelper method createGuestHome.

/**
 * Create a base chief controller for the current anonymous user request
 * and initialize the first screen after login. Note, the user request
 * must be authenticated, but as an anonymous user and not a known user.
 *
 * @param ureq The authenticated user request.
 * @return The chief controller
 */
private static ChiefController createGuestHome(UserRequest ureq) {
    if (!ureq.getUserSession().isAuthenticated())
        throw new AssertException("not authenticated!");
    BaseFullWebappControllerParts guestSitesAndNav = new GuestBFWCParts();
    ChiefController cc = new BaseFullWebappController(ureq, guestSitesAndNav);
    Windows.getWindows(ureq.getUserSession()).setChiefController(cc);
    return cc;
}
Also used : BaseFullWebappController(org.olat.core.commons.fullWebApp.BaseFullWebappController) AssertException(org.olat.core.logging.AssertException) BaseFullWebappControllerParts(org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts) GuestBFWCParts(org.olat.login.GuestBFWCParts) ChiefController(org.olat.core.gui.control.ChiefController)

Aggregations

AssertException (org.olat.core.logging.AssertException)364 IOException (java.io.IOException)38 File (java.io.File)28 Identity (org.olat.core.id.Identity)28 ArrayList (java.util.ArrayList)26 HashMap (java.util.HashMap)24 Controller (org.olat.core.gui.control.Controller)22 OLATResourceable (org.olat.core.id.OLATResourceable)22 RepositoryEntry (org.olat.repository.RepositoryEntry)22 WindowControl (org.olat.core.gui.control.WindowControl)20 UnsupportedEncodingException (java.io.UnsupportedEncodingException)18 JSONException (org.json.JSONException)18 BusinessGroup (org.olat.group.BusinessGroup)18 JSONObject (org.json.JSONObject)16 UserRequest (org.olat.core.gui.UserRequest)16 VFSContainer (org.olat.core.util.vfs.VFSContainer)16 VFSItem (org.olat.core.util.vfs.VFSItem)16 Date (java.util.Date)14 Properties (java.util.Properties)14 Property (org.olat.properties.Property)14