Project

General

Profile

« Previous | Next » 

Revision 5444

Added by berkley almost 14 years ago

fixed problems with access control on sysmeta

View differences:

CrudService.java
268 268
            InputStream object, SystemMetadata sysmeta) throws InvalidToken, 
269 269
            ServiceFailure, NotAuthorized, IdentifierNotUnique, UnsupportedType, 
270 270
            InsufficientResources, InvalidSystemMetadata, NotImplemented {
271
        System.out.println("#####################Create!");
271 272

  
272 273
        logMetacat.debug("Starting CrudService.create()...");
273 274
        
......
332 333
        // For Metadata and Data, insert the system metadata into the object store too
333 334
        String sysMetaLocalId = insertSystemMetadata(sysmeta, sessionData);
334 335
        //get the document info.  add any access params for the sysmeta too
336
        System.out.println("looking for access records to add for system " +
337
            "metadata who's parent doc's  local id is " + localId);
335 338
        try
336 339
        {
337
            Hashtable<String, Object> h = im.getDocumentInfo(sysMetaLocalId);
340
            Hashtable<String, Object> h = im.getDocumentInfo(localId.substring(0, localId.lastIndexOf(".")));
338 341
            Vector v = (Vector)h.get("access");
339 342
            for(int i=0; i<v.size(); i++)
340 343
            {
......
344 347
                String permissionType = (String)ah.get("permission_type");
345 348
                String permissionOrder = (String)ah.get("permission_order");
346 349
                int perm = new Integer(permission).intValue();
347
                this.setAccess(token, guid, principal, perm, permissionType, permissionOrder, false);
350
                System.out.println("found access record for principal " + principal);
351
                System.out.println("permission: " + perm + " perm_type: " + permissionType + 
352
                    " perm_order: " + permissionOrder);
353
                this.setAccess(token, guid, principal, perm, permissionType, permissionOrder, true);
348 354
            }
349 355
        }
350 356
        catch(Exception e)
......
437 443
        {
438 444
            perm = "write";
439 445
        }
446
        System.out.println("perm in setAccess: " + perm);
447
        System.out.println("permission in setAccess: " + permission);
440 448
        setAccess(token, id, principal, perm, permissionType, permissionOrder,
441 449
                setSystemMetadata);
442 450
       
......
1386 1394
        System.out.println("****inserting new system metadata with modified date " + sysmeta.getDateSysMetadataModified());
1387 1395

  
1388 1396
        String xml = new String(serializeSystemMetadata(sysmeta).toByteArray());
1389
        //System.out.println("sysmeta: " + xml);
1397
        System.out.println("sysmeta: " + xml);
1390 1398
        String localId = insertDocument(xml, sysMetaGuid, sessionData);
1391 1399
        System.out.println("sysmeta inserted with localId " + localId);
1392 1400
        //insert the system metadata doc id into the identifiers table to 

Also available in: Unified diff