Package org.wso2.carbon.registry.core.secure

Examples of org.wso2.carbon.registry.core.secure.AuthorizationFailedException


        if (!AuthorizationUtils.authorize(purePath, ActionConstants.GET)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "read the resource " + purePath + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }
        resourceDAO.fillResource((ResourceImpl) resource);
        ((ResourceImpl) resource).setDataAccessManager(dataAccessManager);
        ((ResourceImpl) resource).setUserName(CurrentSession.getUser());
        ((ResourceImpl) resource).setTenantId(CurrentSession.getTenantId());
View Full Code Here


        if (!AuthorizationUtils.authorize(purePath, ActionConstants.GET)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "read the resource " + purePath + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }
        resourceDAO.fillResource(resource, start, pageLen);
        resource.setDataAccessManager(dataAccessManager);
        resource.setUserName(CurrentSession.getUser());
        resource.setTenantId(CurrentSession.getTenantId());
View Full Code Here

        if (!AuthorizationUtils.authorize(path, ActionConstants.DELETE)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "delete the resource " + path + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }
        deleteSubTree(resourceID, resourceDO, false);
        updateParent(resourceDAO.getResourceID(RegistryUtils.getParentPath(path), true));
    }
View Full Code Here

        if (!AuthorizationUtils.authorize(oldPath, ActionConstants.PUT)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "rename the resource " + oldResourcePath + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        move(oldResourcePath, newName);

        return newName;
View Full Code Here

        } else if (!AuthorizationUtils.authorize(targetParentPath, ActionConstants.PUT)) {
            String msg = "Resource Move failed. User " +
                    CurrentSession.getUser() + " is not authorized to update " +
                    "the parent collection of target " + targetParentPath + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        // get the source resource
        ResourceImpl sourceResource = (ResourceImpl) getMetaData(oldPath);
        if (sourceResource == null) {
View Full Code Here

        // read and delete authorization needed for the source (old path)
        if (!AuthorizationUtils.authorize(sourcePath, ActionConstants.GET)) {
            String msg = "Resource Move failed. User " + CurrentSession.getUser() +
                    " is not authorized to read the resource at " + sourcePath + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }
        if (!AuthorizationUtils.authorize(sourcePath, ActionConstants.DELETE)) {
            String msg = "Resource Move failed. User " + CurrentSession.getUser() +
                    " is not authorized to delete the resource at " + sourcePath + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        // check for existence of target path, if target exist delete them
        ResourceIDImpl targetExistingResourceID = resourceDAO.getResourceID(targetPath);
        ResourceDO targetExistingResourceDO;
        if (targetExistingResourceID != null) {
            targetExistingResourceDO = resourceDAO.getResourceDO(targetExistingResourceID);
            if (targetExistingResourceDO == null && targetExistingResourceID.isCollection()) {
                // we have to check the possibility non collection having this path
                targetExistingResourceID = resourceDAO.getResourceID(targetPath, false);
                if (targetExistingResourceID != null) {
                    targetExistingResourceDO = resourceDAO.getResourceDO(targetExistingResourceID);
                }
            }

            if (targetExistingResourceDO != null) {
                // there has been a resource in this place..
                if (!AuthorizationUtils.authorize(targetPath, ActionConstants.PUT)) {
                    String msg = "Resource Move failed. User " +
                            CurrentSession.getUser() + " is not authorized to update " +
                            "the target path " + targetPath + ".";
                    log.warn(msg);
                    throw new AuthorizationFailedException(msg);
                }

                // remove the resource, since we are overwriting that..
                removeIndividual(targetExistingResourceID, targetExistingResourceDO);
            }
View Full Code Here

            // current path.
            String msg = "Failed to add new resource " + path + ". User " +
                    CurrentSession.getUser() + " is not authorized to update " +
                    "the parent collection " + parentPath + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        if (!AuthorizationUtils.authorize(path, ActionConstants.PUT)) {
            String msg = "Failed to add new resource " + path + ". User " +
                    CurrentSession.getUser() + " is not authorized to update " +
                    "the resource path " + path + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        // then add the new resource/collection
        RegistryContext registryContext = null;
        if (CurrentSession.getUserRegistry() != null) {
View Full Code Here

        if (!AuthorizationUtils.authorize(resourceID.getPath(), ActionConstants.PUT)) {
            String msg = "Resource update failed. User " + CurrentSession.getUser() +
                    " is not authorized to update the resource " + resourceID.getPath() + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        // we ignore the resource.isContentModified()), isPropertiesModified
        //  as we have to store the version correctly
View Full Code Here

        if (path.equals(RegistryConstants.ROOT_PATH)) {
            if (!AuthorizationUtils.authorize(path, ActionConstants.PUT)) {
                String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                        "check in to the path " + path + ".";
                log.warn(msg);
                throw new AuthorizationFailedException(msg);
            }
        } else {
            String parentPath = RegistryUtils.getParentPath(path);
            ResourceImpl parentResource = resourceDAO.getResourceMetaData(parentPath);
            if (parentResource == null) {
                addEmptyCollection(parentPath);
            } else {
                if (!(parentResource instanceof CollectionImpl)) {
                    String msg = "Cannot restore into a non-collection at " + parentPath + ".";
                    log.error(msg);
                    throw new RegistryException(msg);
                }
                if (!rootResourceExists) {
                    // we are adding an element to the parent so we need to check the parents
                    // permission
                    if (!AuthorizationUtils.authorize(parentPath, ActionConstants.PUT)) {
                        String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                                "check in to the parent path " + parentPath + ".";
                        log.warn(msg);
                        throw new AuthorizationFailedException(msg);
                    }
                }
            }
        }
        DumpReader dumpReader = new DumpReader(reader);
View Full Code Here

        if (!AuthorizationUtils.authorize(path, ActionConstants.PUT)) {
            String msg = "Failed to check-in resource " + path + ". User " +
                    CurrentSession.getUser() + " is not authorized to update " +
                    "the current collection path " + path + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        while (!xmlReader.isStartElement() && xmlReader.hasNext()) {
            xmlReader.next();
        }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.secure.AuthorizationFailedException

Copyright © 2018 www.massapicom. 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.