Project

General

Profile

Revision 5090

Added by daigle over 11 years ago

Move access control source to it's own directory.

View differences:

src/edu/ucsb/nceas/metacat/DistributionSection.java
31 31

  
32 32
import org.apache.log4j.Logger;
33 33

  
34
import edu.ucsb.nceas.metacat.accesscontrol.AccessSection;
35

  
34 36
/**
35 37
 * A Class that represents an XML access rule. It include principal and
36 38
 * permission
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
73 73
import com.oreilly.servlet.multipart.ParamPart;
74 74
import com.oreilly.servlet.multipart.Part;
75 75

  
76
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile;
77
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
78
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlList;
76 79
import edu.ucsb.nceas.metacat.cart.CartManager;
77 80
import edu.ucsb.nceas.metacat.database.DBConnection;
78 81
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
......
3548 3551
        // Make sure the parameter is not null
3549 3552
        if (docList == null || principalList == null || permTypeList == null
3550 3553
                || permissionList == null) {
3551
            error = "Please check your parameter list, it should look like: "
3554
            error = "MetaCatServlet.handleSetAccessAction - Please check your parameter list, it should look like: "
3552 3555
                    + "?action=setaccess&docid=pipeline.1.1&principal=public"
3553 3556
                    + "&permission=read&permType=allow&permOrder=allowFirst";
3554 3557
            errorList.addElement(error);
......
3569 3572
        	packageSet = 
3570 3573
        		MetacatUtil.getOptionList(PropertyService.getProperty("xml.packagedoctypeset"));
3571 3574
        } catch (PropertyNotFoundException pnfe) {
3572
        	logMetacat.error("Could not find package doctype set.  Setting to null: " 
3575
        	logMetacat.error("MetaCatServlet.handleSetAccessAction - Could not find package doctype set.  Setting to null: " 
3573 3576
        			+ pnfe.getMessage());
3574 3577
        }
3575 3578
        //debug
3576 3579
        if (packageSet != null) {
3577 3580
            for (int i = 0; i < packageSet.size(); i++) {
3578
                logMetacat.debug("doctype in package set: "
3581
                logMetacat.debug("MetaCatServlet.handleSetAccessAction - doctype in package set: "
3579 3582
                        + packageSet.elementAt(i));
3580 3583
            }
3581 3584
        }
......
3601 3604
                owner = getFieldValueForDoc(accessionNumber, "user_owner");
3602 3605
                publicId = getFieldValueForDoc(accessionNumber, "doctype");
3603 3606
            } catch (Exception e) {
3604
                logMetacat.error("Error in handleSetAccessAction: "
3607
                logMetacat.error("MetaCatServlet.handleSetAccessAction - Error in handleSetAccessAction: "
3605 3608
                        + e.getMessage());
3606 3609
                error = "Error in set access control for document - "
3607 3610
                        + accessionNumber + e.getMessage();
......
3643 3646
                try {
3644 3647
                    //insert permission
3645 3648
                    AccessControlForSingleFile accessControl = new AccessControlForSingleFile(
3646
                            accessionNumber, principal, permission, permType,
3647
                            permOrder);
3648
                    if (!accessControl.accessControlExists()) {
3649
                    	accessControl.insertPermissions();
3650
	                    success = "Set access control to document "
3651
	                            + accessionNumber + " successfully";
3652
                    }
3653
                    else {
3654
                    	success = "Access control for document "
3655
                            + accessionNumber + " already exists";
3656
                    }
3657
                    successList.addElement(success);
3649
                            accessionNumber, principal, permission, permType, permOrder);
3650
                    accessControl.insertPermissions();
3658 3651
                } catch (Exception ee) {
3659
                    logMetacat.error(
3660
                            "Erorr in handleSetAccessAction2: "
3652
                    logMetacat.error("MetaCatServlet.handleSetAccessAction - Error inserting permission: "
3661 3653
                            + ee.getMessage());
3662
                    error = "Faild to set access control for document "
3654
                    error = "Failed to set access control for document "
3663 3655
                            + accessionNumber + " because " + ee.getMessage();
3664 3656
                    errorList.addElement(error);
3665 3657
                    continue;
......
3673 3665
            }
3674 3666
            ForceReplicationHandler frh = 
3675 3667
            	new ForceReplicationHandler(accessionNumber, isXml, null);
3676
            logMetacat.debug("ForceReplicationHandler created: " + frh.toString());
3668
            logMetacat.debug("MetaCatServlet.handleSetAccessAction - ForceReplicationHandler created: " + frh.toString());
3677 3669
            
3678 3670
        }
3679 3671
        if (params.get("forwardto")  != null) {
src/edu/ucsb/nceas/metacat/PermissionController.java
36 36

  
37 37
import org.apache.log4j.Logger;
38 38

  
39
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile;
40
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
41
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlList;
39 42
import edu.ucsb.nceas.metacat.database.DBConnection;
40 43
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
41 44
import edu.ucsb.nceas.metacat.properties.PropertyService;
src/edu/ucsb/nceas/metacat/DocumentImpl.java
53 53
import java.util.regex.Matcher;
54 54
import java.util.regex.Pattern;
55 55

  
56
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
57
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlList;
56 58
import edu.ucsb.nceas.metacat.database.DBConnection;
57 59
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
58 60
import edu.ucsb.nceas.metacat.database.DatabaseService;
src/edu/ucsb/nceas/metacat/DBQuery.java
48 48
import org.xml.sax.InputSource;
49 49
import org.w3c.dom.ls.*;
50 50

  
51
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
51 52
import edu.ucsb.nceas.metacat.database.DBConnection;
52 53
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
53 54
import edu.ucsb.nceas.metacat.properties.PropertyService;
src/edu/ucsb/nceas/metacat/DBEntityResolver.java
31 31
import org.xml.sax.*;
32 32
import org.xml.sax.helpers.DefaultHandler;
33 33

  
34
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlList;
34 35
import edu.ucsb.nceas.metacat.database.DBConnection;
35 36
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
36 37
import edu.ucsb.nceas.metacat.util.SystemUtil;
src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java
48 48
import org.xml.sax.Attributes;
49 49
import org.xml.sax.SAXException;
50 50

  
51
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
52
import edu.ucsb.nceas.metacat.accesscontrol.AccessRule;
53
import edu.ucsb.nceas.metacat.accesscontrol.AccessSection;
51 54
import edu.ucsb.nceas.metacat.database.DBConnection;
52 55
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
53 56
import edu.ucsb.nceas.metacat.properties.PropertyService;
src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java
47 47
import org.xml.sax.Attributes;
48 48
import org.xml.sax.SAXException;
49 49

  
50
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
51
import edu.ucsb.nceas.metacat.accesscontrol.AccessRule;
52
import edu.ucsb.nceas.metacat.accesscontrol.AccessSection;
50 53
import edu.ucsb.nceas.metacat.database.DBConnection;
51 54
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
52 55
import edu.ucsb.nceas.metacat.properties.PropertyService;
src/edu/ucsb/nceas/metacat/DocInfoHandler.java
33 33
import org.xml.sax.SAXException;
34 34
import org.xml.sax.helpers.DefaultHandler;
35 35

  
36
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile;
37

  
36 38
/** 
37 39
 * A Class implementing callback bethods for the SAX parser to
38 40
 * call when processing the XML messages from the replication handler

Also available in: Unified diff