Project

General

Profile

« Previous | Next » 

Revision 427

Added by bojilova over 23 years ago

small changes on hasWritePermission()

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
448 448
      pstmt.execute();
449 449
      ResultSet rs = pstmt.getResultSet();
450 450
      boolean hasRows = rs.next();
451
      if ( !hasRows ) {
452
        pstmt.close();
453
        return false;
451
      while ( hasRows ) {
452
        accesstype = rs.getInt(1);
453
        if ( (accesstype & WRITE) == WRITE ) {
454
          pstmt.close();
455
          return true;
456
        }
457
        hasRows = rs.next();
454 458
      }
455 459

  
456
      accesstype = rs.getInt(1);
457 460
      pstmt.close();
458
      
459
      accesstype = accesstype | WRITE;
460
      if ( (accesstype & WRITE) == WRITE ) {
461
        return true;
462
      }
463
      
464 461
      return false;
465 462
      
466 463
    } catch (SQLException e) {
......
492 489
        pstmt.setString(6, user);
493 490
      } else if (action.equals("UPDATE")) {
494 491

  
495
//    moved the check earlier before start of parsing
496
//        // Determine if the docid is OK for an UPDATE
497
//        AccessionNumber ac = new AccessionNumber();
498
//        this.docid = ac.generate(docid, "UPDATE");
499

  
500 492
        // Save the old document entry in a backup table
501 493
        DocumentImpl.archiveDocRevision( conn, docid, user );
502 494

  

Also available in: Unified diff