Package org.dspace.authorize

Examples of org.dspace.authorize.AuthorizeException


        {
            showStatistics(c, request, response);
        }
        else
        {
            throw new AuthorizeException();
        }
    }
View Full Code Here


                && ((ourContext.getCurrentUser() == null) || (ourContext
                        .getCurrentUser().getID() != item.getSubmitter()
                        .getID())))
        {
            // Not an admit, not the submitter
            throw new AuthorizeException("Must be an administrator or the "
                    + "original submitter to delete a workspace item");
        }

        log.info(LogManager.getHeader(ourContext, "delete_workspace_item",
                "workspace_item_id=" + getID() + "item_id=" + item.getID()
View Full Code Here

                }
            }
        }
        else
        {
            throw new AuthorizeException(
                    "Only admin or e-person themselves can subscribe");
        }
    }
View Full Code Here

                                + collection.getID()));
            }
        }
        else
        {
            throw new AuthorizeException(
                    "Only admin or e-person themselves can unsubscribe");
        }
    }
View Full Code Here

            AuthorizeException
    {
        // FIXME - authorization?
        if (!AuthorizeManager.isAdmin(context))
        {
            throw new AuthorizeException(
                    "You must be an admin to create an EPerson Group");
        }

        // Create a table row
        TableRow row = DatabaseManager.create(context, "epersongroup");
View Full Code Here

            AuthorizeException
    {
        // Check authorisation - only administrators can create new formats
        if (!AuthorizeManager.isAdmin(context))
        {
            throw new AuthorizeException(
                    "Only administrators can create bitstream formats");
        }

        // Create a table row
        TableRow row = DatabaseManager.create(context,
View Full Code Here

    public void update() throws SQLException, AuthorizeException
    {
        // Check authorisation - only administrators can change formats
        if (!AuthorizeManager.isAdmin(bfContext))
        {
            throw new AuthorizeException(
                    "Only administrators can modify bitstream formats");
        }

        log.info(LogManager.getHeader(bfContext, "update_bitstream_format",
                "bitstream_format_id=" + getID()));
View Full Code Here

    public void delete() throws SQLException, AuthorizeException
    {
        // Check authorisation - only administrators can delete formats
        if (!AuthorizeManager.isAdmin(bfContext))
        {
            throw new AuthorizeException(
                    "Only administrators can delete bitstream formats");
        }

        // Find "unknown" type
        BitstreamFormat unknown = findUnknown(bfContext);
View Full Code Here

                            log.warn("Skipping Bundle[\""+bundles[i].getName()+"\"] because you are not authorized to read it.");
                            continue;
                        }
                        else
                        {
                            throw new AuthorizeException("Not authorized to read Bundle named \"" + bundles[i].getName() + "\"");
                        }
                    }
                    Bitstream[] bitstreams = bundles[i].getBitstreams();
                    for (int k = 0; k < bitstreams.length; k++)
                    {
                        boolean auth = AuthorizeManager.authorizeActionBoolean(context,
                                bitstreams[k], Constants.READ);
                        if (auth ||
                            (unauth != null && unauth.equalsIgnoreCase("zero")))
                        {
                            String zname = makeBitstreamURL(bitstreams[k], params);
                            ZipEntry ze = new ZipEntry(zname);
                            if (log.isDebugEnabled())
                            {
                                log.debug(new StringBuilder().append("Writing CONTENT stream of bitstream(").append(bitstreams[k].getID()).append(") to Zip: ").append(zname).append(", size=").append(bitstreams[k].getSize()).toString());
                            }
                            if (lmTime != 0)
                            {
                                ze.setTime(lmTime);
                            }
                            else //Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
                            {
                                ze.setTime(DEFAULT_MODIFIED_DATE);
                            }
                            ze.setSize(auth ? bitstreams[k].getSize() : 0);
                            zip.putNextEntry(ze);
                            if (auth)
                            {
                                InputStream input = bitstreams[k].retrieve();
                                Utils.copy(input, zip);
                                input.close();
                            }
                            else
                            {
                                log.warn("Adding zero-length file for Bitstream, SID="
                                        + String.valueOf(bitstreams[k].getSequenceID())
                                        + ", not authorized for READ.");
                            }
                            zip.closeEntry();
                        }
                        else if (unauth != null &&
                                 unauth.equalsIgnoreCase("skip"))
                        {
                            log.warn("Skipping Bitstream, SID="+String.valueOf(bitstreams[k].getSequenceID())+", not authorized for READ.");
                        }
                        else
                        {
                            throw new AuthorizeException("Not authorized to read Bitstream, SID="+String.valueOf(bitstreams[k].getSequenceID()));
                        }
                    }
                }
            }
        }
View Full Code Here

                    {
                        continue;
                    }
                    else
                    {
                        throw new AuthorizeException("Not authorized to read Bundle named \"" + bundles[i].getName() + "\"");
                    }
                }

                Bitstream[] bitstreams = bundles[i].getBitstreams();

                // Create a fileGrp, USE = permuted Bundle name
                FileGrp fileGrp = new FileGrp();
                String bName = bundles[i].getName();
                if ((bName != null) && !bName.equals(""))
                {
                    fileGrp.setUSE(bundleToFileGrp(bName));
                }

                // add technical metadata for a bundle
                String techBundID = addAmdSec(context, bundles[i], params, mets, extraStreams);
                if (techBundID != null)
                {
                    fileGrp.setADMID(techBundID);
                }

                // watch for primary bitstream
                int primaryBitstreamID = -1;
                boolean isContentBundle = false;
                if ((bName != null) && bName.equals("ORIGINAL"))
                {
                    isContentBundle = true;
                    primaryBitstreamID = bundles[i].getPrimaryBitstreamID();
                }

                // For each bitstream, add to METS manifest
                for (int bits = 0; bits < bitstreams.length; bits++)
                {
                    // Check for authorization.  Handle unauthorized
                    // bitstreams to match the logic in disseminate(),
                    // i.e. "unauth=zero" means include a 0-length bitstream,
                    // "unauth=skip" means to ignore it (and exclude from
                    // manifest).
                    boolean auth = AuthorizeManager.authorizeActionBoolean(context,
                            bitstreams[bits], Constants.READ);
                    if (!auth)
                    {
                        if (unauth != null && unauth.equalsIgnoreCase("skip"))
                        {
                            continue;
                        }
                        else if (!(unauth != null && unauth.equalsIgnoreCase("zero")))
                        {
                            throw new AuthorizeException("Not authorized to read Bitstream, SID=" + String.valueOf(bitstreams[bits].getSequenceID()));
                        }
                    }

                    String sid = String.valueOf(bitstreams[bits].getSequenceID());
                    String fileID = bitstreamIDstart + sid;
View Full Code Here

TOP

Related Classes of org.dspace.authorize.AuthorizeException

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.