Examples of JahiaUnauthorizedException


Examples of org.jahia.exceptions.JahiaUnauthorizedException

    public static void checkUserAuthorized(JCRNodeWrapper node, JahiaUser user, String permissions)
            throws JahiaForbiddenAccessException {
        try {
            if (JahiaUserManagerService.isGuest(user)) {
                throw new JahiaUnauthorizedException(
                        "You need to authenticate yourself to use this service");
            } else if (node != null ? !hasRequiredPermission(node, user, permissions)
                    : !hasRequiredPermission(user, permissions)) {
                throw new JahiaForbiddenAccessException(
                        "You have not enough permissions to use this service");
View Full Code Here

Examples of org.jahia.exceptions.JahiaUnauthorizedException

        }
    }

    public static void checkUserLoggedIn(JahiaUser user) throws JahiaForbiddenAccessException {
        if (JahiaUserManagerService.isGuest(user)) {
            throw new JahiaUnauthorizedException(
                    "You need to authenticate yourself to use this service");
        }
    }
View Full Code Here

Examples of org.jahia.exceptions.JahiaUnauthorizedException

                exportRoot = session.getNode(request.getParameter("root"));
            }

            if ("all".equals(exportFormat)) {
                if (!getCurrentUser().isRoot()) {
                    throw new JahiaUnauthorizedException("Only root user can perform export of all content");
                }

                response.setContentType("application/zip");
                //make sure this file is not cached by the client (or a proxy middleman)
                WebUtils.setNoCacheHeaders(response);

                params.put(ImportExportService.INCLUDE_ALL_FILES, Boolean.TRUE);
                params.put(ImportExportService.INCLUDE_TEMPLATES, Boolean.TRUE);
                params.put(ImportExportService.INCLUDE_SITE_INFOS, Boolean.TRUE);
                params.put(ImportExportService.INCLUDE_DEFINITIONS, Boolean.TRUE);
                params.put(ImportExportService.VIEW_WORKFLOW, Boolean.TRUE);
                params.put(ImportExportService.XSL_PATH, cleanupXsl);

                OutputStream outputStream = response.getOutputStream();
                importExportService.exportAll(outputStream, params);
                outputStream.close();
            } else if ("site".equals(exportFormat)) {
                if (!getCurrentUser().isRoot()) {
                    throw new JahiaUnauthorizedException("Only root user can perform export of a site");
                }

                List<JahiaSite> sites = new ArrayList<JahiaSite>();
                String[] sitekeys = request.getParameterValues("sitebox");
                if (sitekeys != null) {
View Full Code Here

Examples of org.jahia.exceptions.JahiaUnauthorizedException

            // check permission
            try {
                if (!hasAccess(urlResolver.getNode())) {
                    if (JahiaUserManagerService.isGuest(jcrSessionFactory.getCurrentUser())) {
                        throw new JahiaUnauthorizedException();
                    } else {
                        throw new JahiaForbiddenAccessException();
                    }
                }
            } catch (PathNotFoundException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.