Project

General

Profile

Revision 6675

give the Metacat admin users FULL permissions on all data/docs
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=4728

View differences:

src/edu/ucsb/nceas/metacat/PermissionController.java
43 43
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
44 44
import edu.ucsb.nceas.metacat.properties.PropertyService;
45 45
import edu.ucsb.nceas.metacat.service.SessionService;
46
import edu.ucsb.nceas.metacat.util.AuthUtil;
46 47
import edu.ucsb.nceas.metacat.util.DocumentUtil;
47 48
import edu.ucsb.nceas.metacat.util.MetacatUtil;
48 49
import edu.ucsb.nceas.metacat.util.SessionData;
49 50
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
51
import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
50 52
import edu.ucsb.nceas.metacat.shared.ServiceException;
51 53

  
52 54
public class PermissionController
......
110 112

  
111 113
  /**
112 114
    * Check from db connection if at least one of the list of @principals
115
    * Administrators are allowed all permission
113 116
    * @param user  the user name
114 117
    * @param groups  the groups which the use is in
115 118
    * @param myPermission  permission type to check for
......
121 124
    String [] userPackage=null;
122 125
    int permission = AccessControlList.intValue(myPermission);
123 126

  
124
    //for the commnad line invocation
127
    //for the command line invocation and replication
125 128
    if ((user==null) && (groups==null || groups.length==0))
126 129
    {
127 130
      return true;
128 131
    }
132
    
133
    // for administrators
134
    //see http://bugzilla.ecoinformatics.org/show_bug.cgi?id=4728
135
    try {
136
		if (AuthUtil.isAdministrator(user, groups)) {
137
			return true;
138
		}
139
	} catch (MetacatUtilException e) {
140
		// not much we can do here, except treat them as normal
141
		logMetacat.warn("Error checking for administrator: " + e.getMessage(), e);
142
	}
129 143

  
130 144
    //create a userpackage including user, public and group member
131 145
    userPackage=createUsersPackage(user, groups);

Also available in: Unified diff