Project

General

Profile

« Previous | Next » 

Revision 4447

translate numeric permission to text permission when serializing.

View differences:

src/edu/ucsb/nceas/metacat/PermissionController.java
705 705
          String permType=rs.getString(3);
706 706
          String permOrder=rs.getString(4);
707 707
          
708
          //translate to string version
709
          String myPermission = AccessControlList.txtValue(Integer.parseInt(permission));
710
          
708 711
          //make it into an object
709 712
          AccessControlForSingleFile acfsf = 
710
        	  new AccessControlForSingleFile(docId, principalName, permission, permType, permOrder);
713
        	  new AccessControlForSingleFile(docId, principalName, myPermission, permType, permOrder);
711 714
          accessControl.add(acfsf);
712 715
        }
713 716
        pStmt.close();
src/edu/ucsb/nceas/metacat/AccessControlForSingleFile.java
198 198
		  sb.append("</permType>");
199 199
		  
200 200
		  sb.append("<permission>");
201
		  sb.append(this.permission);
201
		  sb.append(AccessControlList.txtValue(this.permission));
202 202
		  sb.append("</permission>");
203 203
		  
204 204
		  sb.append("<principal>");
src/edu/ucsb/nceas/metacat/AccessControlList.java
642 642
  }
643 643

  
644 644
  /* Get the text value of READ, WRITE or ALL. */
645
  private String txtValue ( int permission )
645
  public static String txtValue ( int permission )
646 646
  {
647
    StringBuffer txtPerm = new StringBuffer("\"");
648
    if ( (permission & READ) != 0 ) {
649
      txtPerm.append("read");
647
    StringBuffer txtPerm = new StringBuffer();
648
    if (permission == READ) {
649
      txtPerm.append("READ");
650 650
    } 
651
    if ( (permission & WRITE) != 0 ) {
652
      if ( txtPerm.length() > 0 ) txtPerm.append(",");
653
      txtPerm.append("write");
651
    if (permission == WRITE) {
652
      txtPerm.append("WRITE");
654 653
    }
655
    if ( (permission & ALL) != 0 ) {
656
      if ( txtPerm.length() > 0 ) txtPerm.append(",");
657
      txtPerm.append("all");
654
    if (permission == ALL) {
655
      txtPerm.append("ALL");
658 656
    }
659 657

  
660
    return txtPerm.append("\"").toString();
658
    return txtPerm.toString();
661 659
  }
662 660

  
663 661
  /**

Also available in: Unified diff