Project

General

Profile

« Previous | Next » 

Revision 2291

Added by sgarg almost 20 years ago

Modified inline data permission handling, so that access rules for old version of inline data can be checked correctly.

View differences:

src/edu/ucsb/nceas/metacat/PermissionController.java
944 944
   * @param groups, the group which the user belong to
945 945
   */
946 946
   public static Hashtable getUnReadableInlineDataIdList(String docidWithoutRev,
947
                                                   String user, String[] groups)
947
                                                   String user, String[] groups,
948
                                                   boolean withRevision)
948 949
                                                throws Exception
949 950
   {
950 951
     Hashtable inlineDataList = getUnAccessableInlineDataIdList(docidWithoutRev,
951
                              user, groups, AccessControlInterface.READSTRING);
952
                              user, groups, AccessControlInterface.READSTRING,
953
                              withRevision);
952 954

  
953 955
     return inlineDataList;
954 956
   }
......
964 966
  * @param groups, the group which the user belong to
965 967
  */
966 968
  public static Hashtable getUnWritableInlineDataIdList(String docidWithoutRev,
967
                                                  String user, String[] groups)
969
                                                  String user, String[] groups,
970
                                                  boolean withRevision)
968 971
                                               throws Exception
969 972
  {
970 973
    Hashtable inlineDataList = getUnAccessableInlineDataIdList(docidWithoutRev,
971
                            user, groups, AccessControlInterface.WRITESTRING);
974
                            user, groups, AccessControlInterface.WRITESTRING,
975
                            withRevision);
972 976

  
973 977
    return inlineDataList;
974 978
  }
......
977 981
   /*
978 982
    * This method will get hashtable which contains a unaccessable distribution
979 983
    * inlinedata object list
984
    *
985
    * withRevision is used to get inline id list with or without revision number
986
    * e.g. when withRevision is true, temp.1.1.1, temp.1.1.2 would be returned
987
    * otherwise temp.1.1 and temp.1.2 would be returned.
980 988
    */
981 989
   private static Hashtable getUnAccessableInlineDataIdList(String docid,
982
                               String user, String[] groups, String permission)
990
                               String user, String[] groups, String permission,
991
                               boolean withRevision)
983 992
                             throws SQLException,McdbException, Exception
984 993
   {
985 994
      Hashtable unAccessbleIdList = new Hashtable();
......
994 1003
        PermissionController controller = new PermissionController(docid, false);
995 1004
        if (!controller.hasPermissionForInlineData(user, groups, permission, fileId))
996 1005
        {
997
          MetaCatUtil.debugMessage("Put subtree id " +subTreeId + " and " +
998
                                   "inline data file name " + fileId + " into "+
999
                                   "un"+permission+" hash", 20);
1000
          unAccessbleIdList.put(subTreeId, fileId);
1006
            if(withRevision)
1007
            {
1008
                MetaCatUtil.debugMessage("Put subtree id " + subTreeId +
1009
                                         " and " + "inline data file name " +
1010
                                         fileId + " into " + "un" + permission +
1011
                                         " hash", 20);
1012
                unAccessbleIdList.put(subTreeId, fileId);
1013

  
1014
            }
1015
            else
1016
            {
1017
                MetaCatUtil.debugMessage("Put subtree id " + subTreeId +
1018
                                         " and " + "inline data file name " +
1019
                                         MetaCatUtil.
1020
                                         getInlineDataIdWithoutRev(fileId) +
1021
                                         " into " + "un" + permission +
1022
                                         " hash", 20);
1023
                unAccessbleIdList.put(subTreeId, MetaCatUtil.
1024
                                      getInlineDataIdWithoutRev(fileId));
1025
            }
1001 1026
        }
1002 1027
      }
1003 1028
      return unAccessbleIdList;

Also available in: Unified diff