Project

General

Profile

« Previous | Next » 

Revision 6518

set sysmeta submitter based on the subject given in the certificate

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
267 267
        } catch (McdbDocNotFoundException e) {
268 268
            throw new InvalidRequest("1202", "The object with the provided " + "identifier was not found.");
269 269
        }
270
        
271
        // set the submitter to match the certificate
272
        sysmeta.setSubmitter(subject);
270 273

  
271 274
        // does the subject have WRITE ( == update) priveleges on the pid?
272 275
        allowed = isAuthorized(session, pid, Permission.WRITE);
......
335 338
    public Identifier create(Session session, Identifier pid, InputStream object, SystemMetadata sysmeta) throws InvalidToken, ServiceFailure, NotAuthorized,
336 339
            IdentifierNotUnique, UnsupportedType, InsufficientResources, InvalidSystemMetadata, NotImplemented, InvalidRequest {
337 340

  
341
        // set the submitter to match the certificate
342
        sysmeta.setSubmitter(session.getSubject());
343
        // call the shared impl
338 344
        return super.create(session, pid, object, sysmeta);
339 345
    }
340 346

  
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
149 149
    boolean allowed = false;
150 150
    
151 151
    // be sure the user is authenticated for create()
152
    if (subject.getValue() == null || 
153
        subject.getValue().toLowerCase().equals("public") ) {
152
    if (subject == null || subject.getValue() == null || 
153
        subject.getValue().toLowerCase().equals(Constants.PUBLIC_SUBJECT) ) {
154 154
      throw new NotAuthorized("1100", "The provided identity does not have " +
155
        "permission to WRITE to the Member Node.");
155
        "permission to WRITE to the Node.");
156 156
      
157 157
    }
158 158
    
......
176 176
			          " is already used by another object and" +
177 177
			          "therefore can not be used for this object. Clients should choose" +
178 178
			          "a new identifier that is unique and retry the operation or " +
179
			          "use CN_crud.reserveIdentifier() to reserve one.");
179
			          "use CN.reserveIdentifier() to reserve one.");
180 180
    	
181 181
    }
182

  
182
    
183 183
    // check for permission
184 184
    try {
185 185
      allowed = isAuthorized(session, pid, Permission.WRITE);

Also available in: Unified diff